PatrickJS / angular-websocket

:arrow_upper_left: The missing Angular WebSocket module for connecting client applications to servers by @AngularClass
https://angularclass.github.io/angular-websocket
MIT License
1.22k stars 194 forks source link

Can I transmit some data along with the request? #119

Closed dnnagy closed 7 years ago

dnnagy commented 7 years ago

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.

theodesp commented 7 years ago

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

dnnagy commented 7 years ago

Thanks a lot!