Compare commits

...

16 Commits

Author SHA1 Message Date
Guillermo Rauch
00ef9ca652 Release 1.0.0 2014-05-28 10:19:24 -07:00
Guillermo Rauch
2febbce87d Merge pull request #1530 from kevin-roark/update/has-binary-data
bump has-binary-data
2014-05-24 15:19:48 -07:00
Kevin Roark
31c45862cb bump has-binary-data 2014-05-24 14:14:59 -05:00
Guillermo Rauch
809e2bc3f8 Merge pull request #1529 from rase-/add/bc
Added socket.handshake BC object
2014-05-24 11:08:00 -07:00
Tony Kovanen
10adcb089e Added socket.handshake BC object 2014-05-24 17:02:47 +03:00
Guillermo Rauch
5bc75ea944 Release 1.0.0-pre5 2014-05-22 09:35:32 -07:00
Guillermo Rauch
cd4f6ad5e9 package: bump socket.io-client for parser fixes 2014-05-22 09:32:42 -07:00
Guillermo Rauch
54e6c79014 package: bump engine.io 2014-05-22 09:25:58 -07:00
Guillermo Rauch
237b234cab Release 1.0.0-pre4 2014-05-19 16:02:54 -07:00
Guillermo Rauch
547440605d package: bump client 2014-05-19 16:02:31 -07:00
Guillermo Rauch
d763c8b6ea Release 1.0.0-pre3 2014-05-17 15:40:40 -07:00
Guillermo Rauch
5d210ac46c package: bump parser 2014-05-17 14:02:57 -07:00
Guillermo Rauch
ea89e520bc package: bump engine.io 2014-05-16 16:57:41 -07:00
Guillermo Rauch
c8bf064b10 Merge pull request #1513 from hallucynogenyc/patch-1
Update for new npm check
2014-05-06 10:15:33 -04:00
hallucynogenyc
08fe191211 Update for new npm check
Npm will now throw a warning when installing a package:

npm WARN package.json socket.io@1.0.0-pre2 No repository field.

If the repository field is not present.
2014-05-06 16:14:50 +02:00
Guillermo Rauch
0842729c1f test: temporarily removing parser test 2014-04-28 11:16:59 -07:00
4 changed files with 86 additions and 11 deletions

View File

@@ -1,4 +1,26 @@
1.0.0 / 2014-05-28
==================
* stable release
1.0.0-pre5 / 2014-05-22
=======================
* package: bump `socket.io-client` for parser fixes
* package: bump `engine.io`
1.0.0-pre4 / 2014-05-19
=======================
* package: bump client
1.0.0-pre3 / 2014-05-17
=======================
* package: bump parser
* package: bump engine.io
1.0.0-pre2 / 2014-04-27
=======================

View File

@@ -5,6 +5,7 @@
var Emitter = require('events').EventEmitter;
var parser = require('socket.io-parser');
var url = require('url');
var debug = require('debug')('socket.io:socket');
var hasBin = require('has-binary-data');
@@ -65,6 +66,7 @@ function Socket(nsp, client){
this.acks = {};
this.connected = true;
this.disconnected = false;
this.handshake = this.buildHandshake();
}
/**
@@ -95,6 +97,25 @@ Socket.prototype.__defineGetter__('request', function(){
return this.conn.request;
});
/**
* Builds the `handshake` BC object
*
* @api private
*/
Socket.prototype.buildHandshake = function(){
return {
headers: this.request.headers,
time: (new Date) + '',
address: this.request.connection.address(),
xdomain: !!this.request.headers.origin,
secure: !!this.request.connection.encrypted,
issued: +(new Date),
url: this.request.url,
query: url.parse(this.request.url, true).query || {}
};
};
/**
* Emits to this client.
*

View File

@@ -1,6 +1,6 @@
{
"name": "socket.io",
"version": "1.0.0-pre2",
"version": "1.0.0",
"description": "node.js realtime framework server",
"keywords": [
"realtime",
@@ -11,15 +11,19 @@
"socket",
"io"
],
"repository": {
"type": "git",
"url": "git://github.com/LearnBoost/socket.io"
},
"scripts": {
"test": "make test"
},
"dependencies": {
"engine.io": "1.1.0",
"socket.io-parser": "2.1.3",
"socket.io-client": "1.0.0-pre2",
"engine.io": "1.2.1",
"socket.io-parser": "2.1.4",
"socket.io-client": "1.0.0",
"socket.io-adapter": "0.2.0",
"has-binary-data": "0.1.0",
"has-binary-data": "0.1.1",
"debug": "0.7.4"
},
"devDependencies": {

View File

@@ -26,12 +26,6 @@ describe('socket.io', function(){
expect(version).to.be(require('socket.io-client/package').version);
});
it('should have the same protocol version as client', function() {
var pversion = require('socket.io-parser').protocol;
var cparser = require('socket.io-client/node_modules/socket.io-parser');
expect(pversion).to.be(cparser.protocol);
});
describe('set', function() {
it('should be able to set ping timeout to engine.io', function() {
var srv = io(http());
@@ -105,6 +99,40 @@ describe('socket.io', function(){
expect().fail();
});
});
it('should set the handshake BC object', function(done){
var httpSrv = http();
var srv = io(httpSrv);
srv.on('connection', function(s) {
expect(s.handshake).to.not.be(undefined);
// Headers set and has some valid properties
expect(s.handshake.headers).to.be.an('object');
expect(s.handshake.headers['user-agent']).to.be('node-XMLHttpRequest');
// Time set and is valid looking string
expect(s.handshake.time).to.be.a('string');
expect(s.handshake.time.split(' ').length > 0); // Is "multipart" string representation
// Address, xdomain, secure, issued and url set
expect(s.handshake.address).to.not.be(undefined);
expect(s.handshake.xdomain).to.be.a('boolean');
expect(s.handshake.secure).to.be.a('boolean');
expect(s.handshake.issued).to.be.a('number');
expect(s.handshake.url).to.be.a('string');
// Query set and has some right properties
expect(s.handshake.query).to.be.an('object');
expect(s.handshake.query.EIO).to.not.be(undefined);
expect(s.handshake.query.transport).to.not.be(undefined);
expect(s.handshake.query.t).to.not.be(undefined);
done();
});
var socket = client(httpSrv);
});
});
describe('server attachment', function(){