mkuklis / phonegap-websocket

Websocket PhoneGap plugin for Android
203 stars 78 forks source link

Support for subprotocol header #16

Closed rgillan closed 10 years ago

rgillan commented 10 years ago

Similarly to the option header, allow the subprotocol header to be passed to the constructor.

mkuklis commented 10 years ago

This should be already supported by #15. You can now pass headers via options.

dhuyvett commented 10 years ago

Why has this been implemented in a non-standard way? The WebSocket Standard defines the constructor for a WebSocket: [Constructor(DOMString url, optional (DOMString or DOMString[]) protocols)] By assuming that the second argument to the constructor is a JSON object, this breaks standard compliant client code that uses the protocols argument for the constructor.

mkuklis commented 10 years ago

because we need to be able to send additional options / properties used by Java client.

rgillan commented 10 years ago

Michal is correct. Browser implementations (which I am assuming you are referring to as the standard reference) today do not allow setting of multiple headings such as option and subprotocol, and in addition there are underlying settings for message size, fragmentation and the like that need to be passed by the constructor so they are not hard coded in the library/plugin. Most third party libraries are configured in this way. I'm sure it's not too difficult for your JavaScript to create the required JSON object

Please excuse brevity and spelling, sent from my phone.

Cheers Rob

On 12 Oct 2013, at 11:36 am, Michal Kuklis notifications@github.com wrote:

because we need to be able to send additional options / properties used by Java Client.

— Reply to this email directly or view it on GitHub.