embedded-websocket icon indicating copy to clipboard operation
embedded-websocket copied to clipboard

Return sub_protocol on server accept

Open nworbnhoj opened this issue 2 years ago • 1 comments

It seem odd that this call to server_accept forces websocket_protocol to None.

The change proposes a slightly less blunt approach of defaulting to WebSocketContext.sec_websocket_protocol_list[0]

This probably should also include doco for the Server implmentation.

nworbnhoj avatar Apr 20 '22 06:04 nworbnhoj

I like the idea of supporting sub protocols in the framer module but I don't think your implementation would work for all use cases.

I would be better to pass in the chosen websocket sub protocol as follows:

sec_websocket_key: &WebSocketKey,
sec_websocket_protocol: Option<&WebSocketSubProtocol>,

ninjasource avatar Jun 25 '22 11:06 ninjasource