engine.io
Advanced tools
Comparing version 0.8.2 to 0.9.0
0.9.0 / 2014-02-09 | ||
================== | ||
* Prevent errors with connections behind proxies without WS support | ||
like Squid [nicklagrow, samaanghani, davidhcummings] | ||
* Socket#request a simple property [mokesmokes] | ||
* Changed `Socket`'s `upgrade` event to happen after upgrade [mokesmokes] | ||
* Document `Socket#id` [mokesmokes] | ||
0.8.2 / 2014-01-18 | ||
@@ -3,0 +12,0 @@ ================== |
@@ -100,3 +100,3 @@ | ||
Server.prototype.verify = function(req){ | ||
Server.prototype.verify = function(req, upgrade){ | ||
// transport check | ||
@@ -110,5 +110,10 @@ var transport = req.query.transport; | ||
// sid check | ||
if (req.query.sid) { | ||
return this.clients.hasOwnProperty(req.query.sid) || | ||
Server.errors.UNKNOWN_SID; | ||
var sid = req.query.sid; | ||
if (sid) { | ||
if (!this.clients.hasOwnProperty(sid)) | ||
return Server.errors.UNKNOWN_SID; | ||
if (!upgrade && this.clients[sid].transport.name !== transport) { | ||
debug('bad request: unexpected transport without upgrade'); | ||
return Server.errors.BAD_REQUEST; | ||
} | ||
} else { | ||
@@ -163,3 +168,3 @@ // handshake is GET only | ||
var code = this.verify(req); | ||
var code = this.verify(req, false); | ||
if (code !== true) { | ||
@@ -216,3 +221,3 @@ sendErrorMessage(res, code); | ||
} | ||
var socket = new Socket(id, this, transport); | ||
var socket = new Socket(id, this, transport, req); | ||
var self = this; | ||
@@ -247,3 +252,3 @@ | ||
if (this.verify(req) !== true) { | ||
if (this.verify(req, true) !== true) { | ||
socket.end(); | ||
@@ -250,0 +255,0 @@ return; |
@@ -20,3 +20,3 @@ /** | ||
function Socket (id, server, transport) { | ||
function Socket (id, server, transport, req) { | ||
this.id = id; | ||
@@ -29,2 +29,3 @@ this.server = server; | ||
this.sentCallbackFn = []; | ||
this.request = req; | ||
@@ -42,12 +43,2 @@ this.setTransport(transport); | ||
/** | ||
* Accessor for request that originated socket. | ||
* | ||
* @api public | ||
*/ | ||
Socket.prototype.__defineGetter__('request', function () { | ||
return this.transport.request; | ||
}); | ||
/** | ||
* Called upon transport considered open. | ||
@@ -185,5 +176,5 @@ * | ||
self.upgraded = true; | ||
self.emit('upgrade', transport); | ||
self.clearTransport(); | ||
self.setTransport(transport); | ||
self.emit('upgrade', transport); | ||
self.setPingTimeout(); | ||
@@ -190,0 +181,0 @@ self.flush(); |
@@ -50,6 +50,2 @@ | ||
debug('setting request'); | ||
if (undefined === this.req) { | ||
debug('setting handshake request'); | ||
this.request = req; | ||
} | ||
this.req = req; | ||
@@ -56,0 +52,0 @@ }; |
@@ -76,6 +76,2 @@ | ||
debug('setting request'); | ||
if (undefined === this.req) { | ||
debug('setting handshake request'); | ||
this.request = req; | ||
} | ||
@@ -82,0 +78,0 @@ this.req = req; |
{ | ||
"name": "engine.io", | ||
"version": "0.8.2", | ||
"version": "0.9.0", | ||
"description": "The realtime engine behind Socket.IO. Provides the foundation of a bidirectional connection between client and server", | ||
@@ -28,3 +28,3 @@ "main": "./lib/engine.io", | ||
"superagent": "0.15.4", | ||
"engine.io-client": "0.8.2", | ||
"engine.io-client": "0.9.0", | ||
"s": "0.1.1" | ||
@@ -31,0 +31,0 @@ }, |
@@ -0,1 +1,2 @@ | ||
# Engine.IO: the realtime engine | ||
@@ -17,4 +18,4 @@ | ||
```js | ||
var engine = require('engine.io') | ||
, server = engine.listen(80) | ||
var engine = require('engine.io'); | ||
var server = engine.listen(80); | ||
@@ -29,5 +30,5 @@ server.on('connection', function (socket) { | ||
```js | ||
var engine = require('engine.io') | ||
, http = require('http').createServer().listen(3000) | ||
, server = engine.attach(http) | ||
var engine = require('engine.io'); | ||
var http = require('http').createServer().listen(3000); | ||
var server = engine.attach(http); | ||
@@ -43,4 +44,4 @@ server.on('connection', function (socket) { | ||
```js | ||
var engine = require('engine.io') | ||
, server = new engine.Server() | ||
var engine = require('engine.io'); | ||
var server = new engine.Server(); | ||
@@ -250,2 +251,3 @@ server.on('connection', function (socket) { | ||
- `id` _(String)_: unique identifier | ||
- `server` _(Server)_: engine parent reference | ||
@@ -481,10 +483,6 @@ - `request` _(http.ServerRequest)_: request that originated the Socket | ||
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. | ||
Absolutely. The [engine.io-protocol](https://github.com/LearnBoost/engine.io-protocol) | ||
repository contains the most up to date description of the specification | ||
at all times, and the parser implementation in JavaScript. | ||
The Java/NIO implementation will be officially supported, and is being worked | ||
on by the author. | ||
## License | ||
@@ -494,3 +492,3 @@ | ||
Copyright (c) 2011 Guillermo Rauch <guillermo@learnboost.com> | ||
Copyright (c) 2014 Guillermo Rauch <guillermo@learnboost.com> | ||
@@ -497,0 +495,0 @@ Permission is hereby granted, free of charge, to any person obtaining |
1
59785
19
1356
507