Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

faye-websocket

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

faye-websocket - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

5

CHANGELOG.txt

@@ -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 @@

9

lib/faye/eventsource.js

@@ -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 @@ }})

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc