Closed nrgx closed 5 years ago
The problem was that I sent username and message as array. ws4redis sent this to redis, so I got such messages:
127.0.0.1:6379> GET chat:broadcast:test
"alibek,q,qq"
Well redis sees user ("alibek") and message ("q") are separated by a colon, but there is also third item ("qq"). So redis just doesn't do anything to it.
Use JSON.stringufy
at sendMessage()
and JSON.parse
at receiveMessage()
.
Всем спасибо, все свободны.
In ws4redis.js there is a function that sends messages to websockets. But, it only sends messages that are before colon or it slices very large message into small. For example if I write "test, message" it will only send "test" by websocket, but via axios.post I get whole message, also if I'd send "q, message" I'll get only "q". Or if I'll send "lorem" text it will also trim for several characters and the same axios posts whole message.