Skip to content

Commit

Permalink
Fix #13. Automatically convert data to string.
Browse files Browse the repository at this point in the history
  • Loading branch information
majek committed Oct 12, 2011
1 parent 75198b9 commit 2156584
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/sockjs.js
Expand Up @@ -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;
};
4 changes: 2 additions & 2 deletions tests/html/src/tests.coffee
Expand Up @@ -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()
Expand All @@ -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)


Expand Down

0 comments on commit 2156584

Please sign in to comment.