Skip to content

Conversation

nworbnhoj
Copy link

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.

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.
@ninjasource
Copy link
Owner

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>,

.server_accept(
&websocket_context.sec_websocket_key,
None,
Some(WebSocketContext.sec_websocket_protocol_list[0]),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is too fragile and I think we should rather take the chosen sec_websocket_protocol as a parameter to this fuinction

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS, sorry it took so long to get back to you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants