PatrickJS/angular-websocket

Can I transmit some data along with the request?

dnnagy opened this issue · 2 comments

I have to send a client id to the server along with the request. I'm thinking about something like this:

var ws = $websocket('ws://localhost:3333/', { id: "abcdef", client: "browser_Safari" });

The reason to do this is that I'm developing a system where one can control a remote motor from browser via websockets. The backend should know if the request comes from the browser or from the remote motor.

It's not supported in the current WebSocket protocol implementation as the library uses the native Websocket API thus it would make that not portable.
https://developer.mozilla.org/en-US/docs/Web/API/WebSocket

For your issue you can just pass a parameter in the url connection like
$websocket('ws://localhost:3333?id=abcdef&client=browser_Safari')
if that helps

Thanks a lot!