WebSocket connection to 'ws://localhost:8000/' failed: Could not decode a text frame as UTF-8.

2322 views
Skip to first unread message

André Gomes

unread,
May 27, 2014, 11:53:24 AM5/27/14
to tot...@googlegroups.com
Hi!

I'm trying to send this message (image below) through websockets:

However, I'm getting this error on my browser:

WebSocket connection to 'ws://localhost:8000/' failed: Could not decode a text frame as UTF-8.

The error does not happen when I change play.p2.name to "Andre" (instead of "André").

So, that's my question: how can I send non-ascii characters through websockets using totaljs?

Thanks for any help!

Peter Širka

unread,
May 27, 2014, 12:00:14 PM5/27/14
to tot...@googlegroups.com
Hi André,
which version of total.js do you use? Do you have in the route a 'json' flag?

Can you write a small example with the problem (client-side + server-side)?
I will resolve / fix this problem.

Send me it: petersirka(at)gmail(dot)com
Thanks.

André Gomes

unread,
May 27, 2014, 12:06:10 PM5/27/14
to tot...@googlegroups.com
I'm using total.js @ 1.4.0

This is my route:

exports.install = function(framework, name) {
 framework
.websocket('/', socket_handler, ['json']);
};

I'll try to create a minimal app as soon as possible.

Thanks for the help.

Peter Širka

unread,
May 27, 2014, 12:42:56 PM5/27/14
to tot...@googlegroups.com
I found a problem. I disabled auto-encoding messages in v1.4.0.

Add into the your config:

default-websocket-encodedecode : true

And on client-side:

 var mycallback = function(event) {
    console
.log(decodeURIComponent(event.data));
 
};

Thanks :-)
Reply all
Reply to author
Forward
0 new messages