[Libwebsockets] question about multi-protocols in libwebsockets
guojunzhang1981 at gmail.com
Thu Jul 16 20:19:32 CEST 2020
Thank you so much.
that's pretty clear to me now.
On Wed, Jul 15, 2020 at 10:57 PM Andy Green <andy at warmcat.com> wrote:
> On 7/16/20 6:24 AM, Felix Zhang wrote:
> > Hi Andy,
> > Hope you are doing well.
> I wish...
> > I have one question about how to support multiple subprotocol in on a
> > websocket connection.
> > for example,
> > client sends "Sec-WebSocket-Protocol: protocol-a, protocol-b, protocol-c"
> > and server selects only "protocol-a" and "protocol-c" and the response
> > like" Sec-WebSocket-Protocol: protocol-a, protocol-c ".
> That's not quite how it works, the server must pick one that it likes
> best and let the client know what it picked. Since it will be running
> only one negotiated protocol over an individual socket.
> The client then typically binds to the local lws_protocols struct with
> the selected name, allocates user data according to that etc.
> > Is this a common case? and do we support this case today?
> > Thanks in advance.
> Client offering multiple protocols is a normal, standardized case.
> The lws client info struct member can take a comma-separated list:
> On the server side, it goes through what the client sent from left to
> right, and picks the first one it has support for:
> It's not specified in RFC6455 but it's assumed the client placed them in
> order of highest preference first.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libwebsockets