Search code examples
node.jsspring-bootsocket.io-client

Nodejs socket server and spring boot client


I am trying to connect to my socket server in nodejs with client in spring boot. My nodejs client looked like this while establishing connection to my server passing authentication parameters.

 socket = io('localhost:3000', {
          path: 'https://localhost:3000/socket.io',
          auth: {
            username: 'username',
            token: "abcd",
          },
     });

Now I need to switch my nodejs scoket client to spring boot. Any clues on how to do this in spring boot?


Solution

  • There is a java implementation of the client so that should be quite straightforward. See https://socketio.github.io/socket.io-client-java/

    Specifically for auth: https://socketio.github.io/socket.io-client-java/initialization.html#auth