-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Closed
Milestone
Description
hi .. i will just report issue happens to me
i have chat website: nodejs +socket.io for server
some users send posts with emoji and some times result in disconnect all our clients because of:
socket.io-1.4.4.js:1 WebSocket connection to 'wss://***.com:1010/socket.io/?EIO=3&transport=websocket&sid=***' failed: Could not decode a text frame as UTF-8.
WS.doOpen @ socket.io-1.4.4.js:1
i did some debug in server side and print out escapped msg of the post who cause this
here are some of them
%u0627%u0646%0A.%uDFBB.%uDFBB
%u0645%u0627%u0644%u0643%20%u0644%u0632%u0648%u0645%20%u0628%u0641%u0631%u062D%u062A%u064A%20%u0627%u0630%u0627%20%u0628%u062D%u0632%u0646%u0646%u064A%20%u0645%u0627%u0644%u0642%u064A%u062A%u0643%uD83D%uDE34%uD83C%uDF38%0A
in short: just emit this from server to client connected with ws
// \uDF38
socket.emit('data',{msg:'\uDF38'});
// client side error: failed: Could not decode a text frame as UTF-8.
so my quickfix is this method [dont use this fix see my next post]
// server escape recived msg then broudcast it or store it
msg=msg.replace(/([\ud83c\udf00-\udfff])/gi,function(e){return escape(e)});
client side:
msg= unescape(msg);
why i dont just full escape the msg?
*that cost some bandwidth and increase latency if your clients didnt chat in english
any solution is welcome .. thanks
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels