engine.io
Advanced tools
Comparing version 0.1.0 to 0.1.1
0.1.1 / 2012-08-01 | ||
================== | ||
* Fixed errors when a socket is closed while upgrade probe is happening. | ||
* Improved WS error handling | ||
* Replaced websocket.io with ws, now that it supports older drafts | ||
* README fixes | ||
0.1.0 / 2012-07-03 | ||
@@ -3,0 +11,0 @@ ================== |
@@ -6,4 +6,3 @@ | ||
var ws = require('websocket.io') | ||
, qs = require('querystring') | ||
var qs = require('querystring') | ||
, parse = require('url').parse | ||
@@ -15,2 +14,3 @@ , readFileSync = require('fs').readFileSync | ||
, Socket = require('./socket') | ||
, WebSocketServer = require('ws').Server | ||
@@ -44,4 +44,3 @@ /** | ||
if (~this.transports.indexOf('websocket')) { | ||
this.ws = new ws.Server; | ||
this.ws.on('connection', this.onWebSocket.bind(this)); | ||
this.ws = new WebSocketServer({ noServer: true, clientTracking: false }); | ||
} | ||
@@ -220,4 +219,7 @@ }; | ||
// delegate to websocket.io | ||
this.ws.handleUpgrade(req, socket, head); | ||
// delegate to ws | ||
var self = this; | ||
this.ws.handleUpgrade(req, socket, head, function(conn){ | ||
self.onWebSocket(req, conn); | ||
}); | ||
}; | ||
@@ -232,8 +234,10 @@ | ||
Server.prototype.onWebSocket = function (socket) { | ||
var req = socket.req | ||
, id = req.query.sid | ||
Server.prototype.onWebSocket = function (req, socket) { | ||
var id = req.query.sid; | ||
if (id) { | ||
if (this.clients[id].upgraded) { | ||
if (!this.clients[id]) { | ||
debug('upgrade attempt for closed client'); | ||
socket.close(); | ||
} else if (this.clients[id].upgraded) { | ||
debug('transport had already been upgraded'); | ||
@@ -240,0 +244,0 @@ socket.close(); |
@@ -73,3 +73,9 @@ | ||
debug('writing', data); | ||
this.socket.send(data); | ||
this.writable = false; | ||
var self = this; | ||
this.socket.send(data, function (err){ | ||
if (err) return self.onError('write error', err.stack); | ||
self.writable = true; | ||
self.emit('drain'); | ||
}); | ||
} | ||
@@ -76,0 +82,0 @@ }; |
{ | ||
"name": "engine.io" | ||
, "version": "0.1.0" | ||
, "version": "0.1.1" | ||
, "description": "The realtime engine behind Socket.IO. Provides the foundation of a bidirectional connection between client and server" | ||
@@ -8,4 +8,4 @@ , "main": "./lib/engine.io" | ||
"debug": "0.6.0" | ||
, "engine.io-client": "0.1.0" | ||
, "websocket.io": "0.2.1" | ||
, "engine.io-client": "0.1.1" | ||
, "ws": "~0.4.21" | ||
} | ||
@@ -12,0 +12,0 @@ , "devDependencies": { |
@@ -1,2 +0,1 @@ | ||
# Engine.IO: the realtime engine | ||
@@ -41,3 +40,3 @@ | ||
```js | ||
var ws = require('engine.io') | ||
var engine = require('engine.io') | ||
, server = new engine.Server() | ||
@@ -293,3 +292,3 @@ | ||
- `port` (`Number`): port name (`80`) | ||
- `path` (`String`) default prefix path (`/engine.io`) | ||
- `path` (`String`): path to intercept requests to (`/engine.io`) | ||
- `resource` (`String`): name of resource for this server (`default`). | ||
@@ -299,3 +298,3 @@ Setting a resource allows you to initialize multiple engine.io | ||
changing the `path` directly. | ||
- `query` (`String`): optional query string addition (eg: `{ a: 'b' }`) | ||
- `query` (`Object`): optional query string addition (eg: `{ a: 'b' }`) | ||
- `secure` (`Boolean): whether the connection is secure | ||
@@ -305,2 +304,8 @@ - `upgrade` (`Boolean`): defaults to true, whether the client should try | ||
- `forceJSONP` (`Boolean`): forces JSONP for polling transport. | ||
- `timestampRequests` (`Boolean`): whether to add the timestamp with | ||
each transport request. Note: this is ignored if the browser is | ||
IE or Android, in which case requests are always stamped (`false`) | ||
- `timestampParam` (`String`): timestamp parameter (`t`) | ||
- `flashPath` (`String`): path to flash client files with trailing slash | ||
- `policyPort` (`Number`): port the policy server listens on (`843`) | ||
- `transports` (`Array`): a list of transports to try (in order). | ||
@@ -506,6 +511,6 @@ Defaults to `['polling', 'websocket', 'flashsocket']`. `Engine` | ||
Absolutely. The `SPEC` file contains the most up to date description of the | ||
implementation specification at all times. If you're targeting the latest | ||
stable release of `Engine`, make sure to look at the file in the appropriate git | ||
branch/tag. | ||
Absolutely. The [SPEC](https://github.com/LearnBoost/engine.io-client/blob/master/SPEC.md) | ||
file contains the most up to date description of the implementation specification | ||
at all times. If you're targeting the latest stable release of `Engine`, make sure | ||
to look at the file in the appropriate git branch/tag. | ||
@@ -512,0 +517,0 @@ The Java/NIO implementation will be officially supported, and is being worked |
@@ -361,2 +361,15 @@ | ||
}); | ||
it('should abort upgrade if socket is closed (GH-35)', function (done) { | ||
var engine = listen({ allowUpgrades: true }, function (port) { | ||
var socket = new eioc.Socket('ws://localhost:%d'.s(port)); | ||
socket.on('open', function () { | ||
socket.close(); | ||
// we wait until complete to see if we get an uncaught EPIPE | ||
setTimeout(function(){ | ||
done(); | ||
}, 100); | ||
}); | ||
}); | ||
}); | ||
}); | ||
@@ -363,0 +376,0 @@ |
77398
2011
539
+ Addedws@~0.4.21
+ Addedcommander@2.1.0(transitive)
+ Addedengine.io-client@0.1.1(transitive)
+ Addednan@1.0.0(transitive)
+ Addedws@0.4.32(transitive)
- Removedwebsocket.io@0.2.1
- Removedengine.io-client@0.1.0(transitive)
- Removedwebsocket.io@0.2.1(transitive)
Updatedengine.io-client@0.1.1