mirror of https://github.com/calzoneman/sync.git
Fix NWS failing on non-ASCII messages
This commit is contained in:
parent
81d85311e7
commit
11734f5e62
|
@ -151,7 +151,7 @@ function msgReceived(req, res) {
|
||||||
sendJSON(res, clients[h].poll());
|
sendJSON(res, clients[h].poll());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
clients[h].recv(unescape(str));
|
clients[h].recv(decodeURIComponent(str));
|
||||||
sendJSON(res, "");
|
sendJSON(res, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ NotWebsocket.prototype.emit = function(msg, data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var pkt = [msg, data];
|
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() {
|
$.getJSON(WEB_URL+"/nws/"+this.hash+"/"+str+"?callback=?", function() {
|
||||||
// Poll more quickly because sending a packet usually means
|
// Poll more quickly because sending a packet usually means
|
||||||
// expecting some data to come back
|
// expecting some data to come back
|
||||||
|
|
Loading…
Reference in New Issue