-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support new param 'response_class' in websocket_client.ws_connect. #367
Conversation
@@ -87,7 +87,9 @@ def ws_connect(url, protocols=(), timeout=10.0, connector=None, | |||
reader = resp.connection.reader.set_parser(WebSocketParser) | |||
writer = WebSocketWriter(resp.connection.writer, use_mask=True) | |||
|
|||
return ClientWebSocketResponse( | |||
response_class = response_class or ClientWebSocketResponse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use
if response_class is None:
response_class = ClientWebSocketResponse idiom
The patch is LGTM (except my inline note). |
Thanks asvetlov! I updated the patch to reflect your inline note. |
Couple more small changes for consistency in the docs. I'm done now with this feature. |
support new param 'response_class' in websocket_client.ws_connect.
Thanks! |
Thank you for reviewing @asvetlov Quick question: when you said earlier "I think we should add websockets (and maybe multiparts) to ClientSession also", were you referring to using the |
I think we need |
@davebshow if you would make PR for that -- please do. It will be at least nice starting point. |
Adds a 'response_class' parameter to
websocket_client.ws_connect
that allows user to implement a customClientWebSocketResponse
style class and pass it to thews_connect
coroutine. Similar to 'response_class' param foraiohttp.client.request
.