Fix NWS failing on non-ASCII messages

This commit is contained in:
calzoneman 2013-06-25 10:48:14 -04:00
parent 81d85311e7
commit 11734f5e62
2 changed files with 2 additions and 2 deletions

View File

@ -151,7 +151,7 @@ function msgReceived(req, res) {
sendJSON(res, clients[h].poll());
}
else {
clients[h].recv(unescape(str));
clients[h].recv(decodeURIComponent(str));
sendJSON(res, "");
}
}

View File

@ -76,7 +76,7 @@ NotWebsocket.prototype.emit = function(msg, data) {
return;
}
var pkt = [msg, data];
var str = escape(JSON.stringify(pkt)).replace(/\//g, "%2F");
var str = encodeURIComponent(JSON.stringify(pkt)).replace(/\//g, "%2F");
$.getJSON(WEB_URL+"/nws/"+this.hash+"/"+str+"?callback=?", function() {
// Poll more quickly because sending a packet usually means
// expecting some data to come back