vicariousdrama / cornychat

🌽 Corny Chat is an open source audio space built on Jam that integrates Nostr and Lightning
https://cornychat.com
GNU Affero General Public License v3.0
21 stars 6 forks source link

Text Chat can Crash Room Connections #83

Open vicariousdrama opened 1 week ago

vicariousdrama commented 1 week ago

Sample...

pasting the name of this npub into corny chat text consistently crashes the room connections npub1372csjhjv35sxcqm90ca2d0cfxsl6xku7j6hhswynwdy9m7zl98scn950w Nëïgsëndöïg Cöcülës

Here's what it looks like in the websocket connection image

Could not decode a text frame as UTF-8

vicariousdrama commented 1 week ago

Google -> Stackoverflow

https://stackoverflow.com/questions/56429498/how-to-fix-could-not-decode-a-text-frame-as-utf-8-when-sending-rabbitmq-buff

Alright, I answered my own question. I read a reply at Could not decode a text frame as UTF-8. that suggested JSON.stringify is sufficient to create an object acceptable to the Websocket protocol. Then I created a buffer from that. So, the back-end code changed to:

channel.sendToQueue(queue, Buffer.from(JSON.stringify(msgpack.encode(data))), options);
vicariousdrama commented 1 week ago

This happens when

Does not appear to happen from

vicariousdrama commented 1 week ago

Testing from windows targetting dev on linux .. this worked just fine

vicariousdrama commented 1 week ago

This can happen from linux as well. Prior tests were on dev vs production, and the key difference between these two deployments is that production uses the pantry-sfu and dev does not.

On linux + firefox, the result looks like this when it fails and terminates the websocket image

vicariousdrama commented 1 week ago

Made a change in ca53ddd9f9b12fd8a074b8ec68d087fc407182aa and will check on production after next push. Was not able to fully replicate the issue in dev.

vicariousdrama commented 1 week ago

This patch has been applied to the server and seems to be working