Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d3e81b478e | |||
| c5b3df986b | |||
| 286dea4337 | |||
| 2378f4c484 |
@@ -1,3 +1,7 @@
|
||||
### 0.2.2 / 2013-07-05
|
||||
|
||||
* No functional changes, just updates to package.json
|
||||
|
||||
### 0.2.1 / 2013-05-17
|
||||
|
||||
* Export the isSecureRequest() method since faye-websocket relies on it
|
||||
|
||||
@@ -62,15 +62,14 @@ server.on('upgrade', function(request, socket, body) {
|
||||
var driver = websocket.http(request);
|
||||
|
||||
driver.io.write(body);
|
||||
socket.pipe(driver.io);
|
||||
driver.io.pipe(socket);
|
||||
socket.pipe(driver.io).pipe(socket);
|
||||
|
||||
driver.messages.on('data', function(message) {
|
||||
console.log('Got a message', message);
|
||||
});
|
||||
|
||||
driver.start();
|
||||
};
|
||||
});
|
||||
```
|
||||
|
||||
Note the line `driver.io.write(body)` - you must pass the `body` buffer to the
|
||||
@@ -104,8 +103,7 @@ var server = net.createServer(function(connection) {
|
||||
driver.on('close', function() { connection.end() });
|
||||
connection.on('error', function() {});
|
||||
|
||||
connection.pipe(driver.io);
|
||||
driver.io.pipe(connection);
|
||||
connection.pipe(driver.io).pipe(connection);
|
||||
|
||||
driver.messages.pipe(driver.messages);
|
||||
});
|
||||
@@ -138,8 +136,7 @@ var net = require('net'),
|
||||
var driver = websocket.client('ws://www.example.com/socket'),
|
||||
tcp = net.createConnection(80, 'www.example.com');
|
||||
|
||||
tcp.pipe(driver.io);
|
||||
driver.io.pipe(tcp);
|
||||
tcp.pipe(driver.io).pipe(tcp);
|
||||
|
||||
driver.messages.on('data', function(message) {
|
||||
console.log('Got a message', message);
|
||||
|
||||
+8
-13
@@ -3,24 +3,19 @@
|
||||
, "homepage" : "http://github.com/faye/websocket-driver-node"
|
||||
, "author" : "James Coglan <jcoglan@gmail.com> (http://jcoglan.com/)"
|
||||
, "keywords" : ["websocket"]
|
||||
, "license" : "MIT"
|
||||
|
||||
, "version" : "0.2.1"
|
||||
, "version" : "0.2.2"
|
||||
, "engines" : {"node": ">=0.4.0"}
|
||||
, "main" : "./lib/websocket/driver"
|
||||
, "devDependencies" : {"jsclass": ""}
|
||||
, "devDependencies" : {"jstest": ""}
|
||||
|
||||
, "scripts" : {"test": "node spec/runner.js"}
|
||||
, "scripts" : {"test": "jstest spec/runner.js"}
|
||||
|
||||
, "repository" : { "type" : "git"
|
||||
, "url" : "git://github.com/faye/websocket-driver-node.git"
|
||||
}
|
||||
|
||||
, "bugs" : "http://github.com/faye/websocket-driver-node/issues"
|
||||
|
||||
, "licenses" : [ { "type" : "MIT"
|
||||
, "url" : "http://www.opensource.org/licenses/mit-license.php"
|
||||
}
|
||||
]
|
||||
|
||||
, "repositories" : [ { "type" : "git"
|
||||
, "url" : "git://github.com/faye/websocket-driver-node.git"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
+15
-19
@@ -1,6 +1,5 @@
|
||||
require('jsclass')
|
||||
|
||||
var Stream = require('stream').Stream,
|
||||
var test = require('jstest').Test,
|
||||
Stream = require('stream').Stream,
|
||||
util = require('util')
|
||||
|
||||
var BufferMatcher = function(data) {
|
||||
@@ -29,21 +28,18 @@ Collector.prototype.write = function(buffer) {
|
||||
return true
|
||||
}
|
||||
|
||||
JS.require('JS.Test', function() {
|
||||
JS.Test.Unit.TestCase.include({
|
||||
buffer: function(data) {
|
||||
return new BufferMatcher(data)
|
||||
},
|
||||
collector: function() {
|
||||
return this._collector = this._collector || new Collector()
|
||||
}
|
||||
})
|
||||
|
||||
require('./websocket/driver/draft75_examples')
|
||||
require('./websocket/driver/draft75_spec')
|
||||
require('./websocket/driver/draft76_spec')
|
||||
require('./websocket/driver/hybi_spec')
|
||||
require('./websocket/driver/client_spec')
|
||||
JS.Test.autorun()
|
||||
test.Unit.TestCase.include({
|
||||
buffer: function(data) {
|
||||
return new BufferMatcher(data)
|
||||
},
|
||||
collector: function() {
|
||||
return this._collector = this._collector || new Collector()
|
||||
}
|
||||
})
|
||||
|
||||
require('./websocket/driver/draft75_examples')
|
||||
require('./websocket/driver/draft75_spec')
|
||||
require('./websocket/driver/draft76_spec')
|
||||
require('./websocket/driver/hybi_spec')
|
||||
require('./websocket/driver/client_spec')
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
var Client = require("../../../lib/websocket/driver/client")
|
||||
var Client = require("../../../lib/websocket/driver/client"),
|
||||
test = require('jstest').Test
|
||||
|
||||
JS.Test.describe("Client", function() { with(this) {
|
||||
test.describe("Client", function() { with(this) {
|
||||
define("options", function() {
|
||||
return this._options = this._options || {protocols: this.protocols()}
|
||||
})
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
JS.Test.describe("draft-75", function() { with(this) {
|
||||
var test = require('jstest').Test
|
||||
|
||||
test.describe("draft-75", function() { with(this) {
|
||||
sharedExamplesFor("draft-75 protocol", function() { with(this) {
|
||||
describe("in the open state", function() { with(this) {
|
||||
before(function() { this.driver().start() })
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
var Draft75 = require("../../../lib/websocket/driver/draft75")
|
||||
var Draft75 = require("../../../lib/websocket/driver/draft75"),
|
||||
test = require('jstest').Test
|
||||
|
||||
JS.Test.describe("Draft75", function() { with(this) {
|
||||
test.describe("Draft75", function() { with(this) {
|
||||
define("request", function() {
|
||||
return this._request = this._request || {
|
||||
headers: {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
var Draft76 = require("../../../lib/websocket/driver/draft76")
|
||||
var Draft76 = require("../../../lib/websocket/driver/draft76"),
|
||||
test = require('jstest').Test
|
||||
|
||||
JS.Test.describe("Draft76", function() { with(this) {
|
||||
test.describe("Draft76", function() { with(this) {
|
||||
BODY = new Buffer([0x91, 0x25, 0x3e, 0xd3, 0xa9, 0xe7, 0x6a, 0x88])
|
||||
|
||||
define("body", function() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
var Hybi = require("../../../lib/websocket/driver/hybi")
|
||||
var Hybi = require("../../../lib/websocket/driver/hybi"),
|
||||
test = require('jstest').Test
|
||||
|
||||
JS.Test.describe("Hybi", function() { with(this) {
|
||||
test.describe("Hybi", function() { with(this) {
|
||||
define("request", function() {
|
||||
return this._request = this._request || {
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user