We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
channels/generic/websocket.py in websocket_disconnect at line 238
await self.channel_layer.group_discard(group, self.channel_name) except AttributeError: raise InvalidChannelLayerError( "BACKEND is unconfigured or doesn't support groups" ) await self.disconnect(message["code"]) raise StopConsumer()
Got KeyError "code". How to solve a problem???
The text was updated successfully, but these errors were encountered:
This would be addressed by #1905, which is lacking a regression test currently.
Sorry, something went wrong.
Perhaps I can handle this error? Because my Sentry are full of such errors.
class ConnectionConsumer(AsyncWebsocketConsumer): async def connect(self): """ Called on connection """ try: await self.accept() except (ConnectionClosedError, ConnectionClosedOK, KeyError): await self.close(code=1005) async def receive(self, text_data=None, bytes_data=None): """ Receive a message and send it back """ text_data_json = json.loads(text_data) message = text_data_json.get('message', None) try: await self.send(text_data=json.dumps({'message': message})) except (ConnectionClosedError, ConnectionClosedOK, KeyError): await self.close(code=1005)
No branches or pull requests
channels/generic/websocket.py in websocket_disconnect at line 238
Got KeyError "code". How to solve a problem???
The text was updated successfully, but these errors were encountered: