diff --git a/lib/sockjs.js b/lib/sockjs.js index 1f33fa58..8e1a292a 100644 --- a/lib/sockjs.js +++ b/lib/sockjs.js @@ -189,7 +189,7 @@ SockJS.prototype.send = function(data) { if (that.readyState === SockJS.CONNECTING) throw new Error('INVALID_STATE_ERR'); if (that.readyState === SockJS.OPEN) { - that._transport.doSend(JSON.stringify(data)); + that._transport.doSend(JSON.stringify('' + data)); } return true; }; diff --git a/tests/html/src/tests.coffee b/tests/html/src/tests.coffee index 3c791abf..5e1ded08 100644 --- a/tests/html/src/tests.coffee +++ b/tests/html/src/tests.coffee @@ -21,7 +21,7 @@ echo_factory_factory = (protocol, messages) -> r.send(a[0]) r.onmessage = (e) -> #log('onmessage ' + e); - deepEqual(e.data, a[0]) + equal(e.data, '' + a[0]) a.shift() if typeof a[0] is 'undefined' r.close() @@ -39,7 +39,7 @@ factor_echo_basic = (protocol) -> return echo_factory_factory(protocol, messages) factor_echo_rich = (protocol) -> - messages = [ [1,2,3,'data'], null, "data", 1, 12.0, {a:1, b:2} ] + messages = [ [1,2,3,'data'], null, false, "data", 1, 12.0, {a:1, b:2} ] return echo_factory_factory(protocol, messages)