hynek-urban / rocketchat-async

asyncio-based Python wrapper for the Rocket.Chat Realtime API.
MIT License
11 stars 9 forks source link

_process_incoming_event crashes when processing events with no "msg" fields. #5

Closed dborry closed 2 months ago

dborry commented 6 months ago

When trying to connect to my Rocket.Chat's wss, I noticed the _process_incoming_event always checks for a msg field in received events, but right after starting a session the RC server also sends this event:

{"server_id":"0"}

This causes a crash at this line because it doesn't check that the response has a msg field: https://github.com/hynek-urban/rocketchat-async/blob/master/rocketchat_async/dispatcher.py#L55

hynek-urban commented 5 months ago

Hi @dborry ,

thanks for reporting this. I can't reproduce this, though... what is the version of rocketchat you are using? And how are you deploying this?

Looking at the documentation, it seems that the event should always contain a msg field - and it works that way on my end. Googling for this, I found a few messages mentioning the {"server_id": "0"} format from years ago - could it be that you're using some old version of rocket.chat?

hynek-urban commented 2 months ago

Closing this since it can't be reproduced and there are no further details.