TooTallNate / Java-WebSocket

A barebones WebSocket client and server implementation written in 100% Java.
http://tootallnate.github.io/Java-WebSocket
MIT License
10.47k stars 2.57k forks source link

how to get session id to send messages #1324

Closed jiawade closed 1 year ago

jiawade commented 1 year ago

my websockt uri is: ws://192.168.0.1:19900/socket/?EIO=3&transport=websocket&sid=30101e05-abcc-41c5-b361-376a814fd580 If I want to send messages to the server, must hava a valid sid, so how to create connection and get the sid My guess is to send an authentication token to the server when creating a connection, such as a Bearer type token

PhilipRoman commented 1 year ago

From the URI you gave it seems you're using socket.io, which is a different protocol from websockets. Socket.io sometimes uses websockets for transport, but it has a lot of additional features on top of it which this library doesn't know about.

I recommend you find a library that supports Socket.io unless you want to reimplement a lot of code on top of websockets.

jiawade commented 1 year ago

I See, thanks @PhilipRoman