How to use socket.connect() in client to pass Data/Credentials on connection to server in react

110 Views Asked by At

Need to pass the userName and role during the connection to the web socket.

While using postman used to add additional headers or query string to pass on the data. But in react, the connection is getting established during the page load. So I am not able to add any query or credentials to the connection request.

Using { autoConnect: false } to prevent connection in begin

Is there any way to pass the data while using socket.connect() method

like socket.connect({query: 'foo=boo'})

0

There are 0 best solutions below