title: Connect user and server on custom patch ,socket.io Express
body: <p>I can not figure out how to connect the client to the server using sockets.</p>
  <p>I use
  &quot;nuxt&quot;: &quot;^2.14.12&quot;,
  &quot;socket.io&quot;: &quot;^4.4.1&quot;,
  &quot;vue-socket.io&quot;: &quot;^3.0.10&quot;,</p>
  <p>My client and server are on port 4500, but the server is prefixed with api . The server is on express and there are a lot of API routes, when I try to pass the api key to the sockets, I get the standard nuxt page that this route was not found.</p>
  <p><a href="https://i.stack.imgur.com/d5ztd.png" rel="nofollow noreferrer">1</a>: <a href="https://i.stack.imgur.com/GkLsm.png" rel="nofollow noreferrer">https://i.stack.imgur.com/GkLsm.png</a> <a href="https://i.stack.imgur.com/d5ztd.png" rel="nofollow noreferrer">1</a></p>
  <p>my front :</p>
  <pre class="lang-js prettyprint-override"><code>import Vue from &quot;vue&quot;;
  import VueSocketIO from &quot;vue-socket.io&quot;;
  import io from &quot;socket.io-client&quot;;
  
  const socketInstance = io(&quot;http://localhost:4500/&quot;, {
    rejectUnauthorized: true,
    path: &quot;/api/&quot;,
    reconnection: true,
    reconnectionDelay: 1000,
    reconnectionDelayMax: 5000,
    reconnectionAttempts: 15,
  });
  export default ({ store }) =&gt; {
    Vue.use(
      new VueSocketIO({
        debug: true,
        connection: socketInstance,
        vuex: {
          store,
          actionPrefix: &quot;SOCKET_&quot;,
          mutationPrefix: &quot;SOCKET_&quot;,
        },
      })
    );
  };
  </code></pre>
  <p>my server</p>
  <pre class="lang-js prettyprint-override"><code>const express = require(&quot;express&quot;);
  const app = express();
  const http = require(&quot;http&quot;);
  const server = http.createServer(app);
  const { Server } = require(&quot;socket.io&quot;);
  const io = new Server(server);
  io.on(&quot;connection&quot;, (socket) =&gt; {
    console.log(&quot;a user connected&quot;);
    socket.on(&quot;disconnect&quot;, () =&gt; {
      console.log(&quot;user disconnected&quot;);
    });
  });
  </code></pre>
  <p>How can I connect client and server?</p>