faye-websocket
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -0,1 +1,6 @@ | ||
=== 0.4.1 / 2012-02-26 | ||
* Treat anything other than a Buffer as a string when calling send() | ||
=== 0.4.0 / 2012-02-13 | ||
@@ -2,0 +7,0 @@ |
@@ -65,3 +65,5 @@ var API = require('./websocket/api'), | ||
send: function(message, options) { | ||
message = message.replace(/(\r\n|\r|\n)/g, '$1data: '); | ||
if (this.readyState !== API.OPEN) return false; | ||
message = String(message).replace(/(\r\n|\r|\n)/g, '$1data: '); | ||
options = options || {}; | ||
@@ -76,3 +78,6 @@ | ||
this._stream.write(frame, 'utf8'); | ||
} catch (e) {} | ||
return true; | ||
} catch (e) { | ||
return false; | ||
} | ||
}, | ||
@@ -79,0 +84,0 @@ |
@@ -46,2 +46,4 @@ var EventTarget = require('./api/event_target'), | ||
if (!(data instanceof Buffer)) data = String(data); | ||
var frame = this._parser.frame(data, type, errorType); | ||
@@ -48,0 +50,0 @@ try { |
@@ -7,3 +7,3 @@ { "name" : "faye-websocket" | ||
, "version" : "0.4.0" | ||
, "version" : "0.4.1" | ||
, "engines" : {"node": ">=0.4.0"} | ||
@@ -10,0 +10,0 @@ , "main" : "./lib/faye/websocket" |
@@ -63,9 +63,9 @@ var Client = require('../../../lib/faye/websocket/client') | ||
send_message: function(callback) { | ||
this._ws.send("I expect this to be echoed") | ||
send_message: function(message, callback) { | ||
this._ws.send(message) | ||
setTimeout(callback, 100) | ||
}, | ||
check_response: function(callback) { | ||
this.assertEqual( "I expect this to be echoed", this._message ) | ||
check_response: function(message, callback) { | ||
this.assertEqual( message, this._message ) | ||
callback() | ||
@@ -120,5 +120,23 @@ }, | ||
listen_for_message() | ||
send_message() | ||
check_response() | ||
send_message("I expect this to be echoed") | ||
check_response("I expect this to be echoed") | ||
}}) | ||
it("sends numbers as strings", function() { with(this) { | ||
listen_for_message() | ||
send_message(13) | ||
check_response("13") | ||
}}) | ||
it("sends booleans as strings", function() { with(this) { | ||
listen_for_message() | ||
send_message(false) | ||
check_response("false") | ||
}}) | ||
it("sends arrays as strings", function() { with(this) { | ||
listen_for_message() | ||
send_message([13,14,15]) | ||
check_response("13,14,15") | ||
}}) | ||
}}) | ||
@@ -134,3 +152,3 @@ | ||
listen_for_message() | ||
send_message() | ||
send_message("I expect this to be echoed") | ||
check_no_response() | ||
@@ -137,0 +155,0 @@ }}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
71678
1413