title: Setup basic socket.io with Svelte/Vite
body: <p>So recently I started messing around with Svelte and ran into an issue setting up a socket.io server</p>
  <p>so far I have simple web server setup with svelte-adapter-node and I have the socket.io client stuff setup.</p>
  <p>here's my current setup</p>
  <pre class="lang-java prettyprint-override"><code>// server.js
  import { handler } from './build/handler.js';
  import express from 'express';
  const app = express();
  import http from &quot;http&quot;;
  const server = http.createServer(app);
  import { Server } from &quot;socket.io&quot;;
  var io = new Server(server).listen(server);
  
  app.use(handler);
  
  io.on(&quot;connection&quot;, function(socket) {
      console.log(&quot;A user connected&quot;);
  
      socket.on(&quot;disconnected&quot;, function () {
          console.log(&quot;A user disconnected&quot;);
      });
  });
  
  server.listen(3000, () =&gt; {
      console.log('listening on port 3000');
  });
  </code></pre>
  <p>It gives the <code>http://localhost:3000/socket.io?EIO=4&amp;transport=polling&amp;t=Nudyw9R</code> error in the browser</p>