Comparing version 0.0.8 to 0.0.9
@@ -7,3 +7,3 @@ module.exports = { | ||
"request" : require('./WebSocketRequest'), | ||
"version" : "0.0.8" | ||
"version" : "0.0.9" | ||
}; |
@@ -353,6 +353,5 @@ var crypto = require('crypto'); | ||
WebSocketConnection.prototype.sendUTF = function(data) { | ||
data = new Buffer(data); | ||
var frame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); | ||
frame.opcode = 0x01; // WebSocketOpcode.TEXT_FRAME | ||
frame.binaryPayload = new Buffer(data, 'utf8'); | ||
frame.binaryPayload = new Buffer(data.toString(), 'utf8'); | ||
this.fragmentAndSend(frame); | ||
@@ -362,2 +361,5 @@ }; | ||
WebSocketConnection.prototype.sendBytes = function(data) { | ||
if (!Buffer.isBuffer(data)) { | ||
throw new Error("You must pass a Node Buffer object to WebSocketConnection.prototype.sendBytes()"); | ||
} | ||
var frame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); | ||
@@ -364,0 +366,0 @@ frame.opcode = 0x02; // WebSocketOpcode.BINARY_FRAME |
@@ -6,3 +6,3 @@ { | ||
"author": "Brian McKelvey <brian@worlize.com>", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"repository": { | ||
@@ -9,0 +9,0 @@ "type": "git", |
@@ -122,3 +122,3 @@ WebSocket Client & Server Implementation for Node | ||
connection.on('close', function() { | ||
console.log("dumb-increment-protocol Connection Closed"); | ||
console.log("echo-protocol Connection Closed"); | ||
}) | ||
@@ -132,3 +132,3 @@ connection.on('message', function(message) { | ||
var number = Math.round(Math.random() * 0xFFFFFF); | ||
connection.sendUTF(number); | ||
connection.sendUTF(number.toString()); | ||
setTimeout(sendNumber, 1000); | ||
@@ -135,0 +135,0 @@ } |
262495
6905