Closed physiii closed 7 years ago
Ws standard declares you can only negotiate a single protocol on one ws connection.
What you want, "I want to use multiple protocols on a single client connection. ", ws itself cannot do.
Yes you must make two connections, or subsume the stuff in token-protocol into microphone-protocoo.
What has worked well for me is mix JSON, using ws TEXT, and some other protocol, using ws BINARY, on the one ws connection. Js at the browser can tell if the message was text or binary and separate them that way.
I was planning on making protocols for each sensor so using text and binary may not be the best option. Thinking I should move everything into one protocol but it would be nice to control lws_service loop time for different sensors.
[update] actually I like using separate connections for each protocol like I original thought
I want to use multiple protocols on a single client connection. I figured I would use:
i.protocol = "microphone-protocol,token-protocol";
But that just picks one of the protocols in the list. Do I need to make separate connections with lws_client_connect_via_info?
https://github.com/physiii/liger/blob/master/code/main/main.c