Compare commits

..

15 Commits
1.4.3 ... 1.4.5

Author SHA1 Message Date
Guillermo Rauch
b3fc530abe Release 1.4.5 2016-01-26 13:26:17 -08:00
Guillermo Rauch
d0dfa54dcb package: bump engine.io 2016-01-26 10:42:41 -08:00
Guillermo Rauch
198b836759 Merge pull request #2399 from nkzawa/graceful-close
Add a test for graceful shutdown
2016-01-21 09:15:36 -08:00
nkzawa
a75f46f06f add a test for graceful shutdown 2016-01-21 20:50:44 +09:00
Naoyuki Kanezawa
2a91fd57c7 Merge pull request #2344 from denghongcai/patch-2
fix wrong jsdoc
2016-01-17 15:25:32 +09:00
Naoyuki Kanezawa
fe891293b2 Merge pull request #2353 from faizalpribadi/patch-1
fix typo word :)
2016-01-17 15:23:35 +09:00
Naoyuki Kanezawa
6e450f75b4 Merge pull request #2374 from darrachequesne/patch-4
Add badges showing dependency status
2016-01-17 15:22:52 +09:00
Naoyuki Kanezawa
22c985cae6 Merge pull request #2380 from darrachequesne/patch-5
Document type change of Socket#rooms
2016-01-17 15:22:05 +09:00
Guillermo Rauch
fea3d79a2c Release 1.4.4 2016-01-10 22:36:31 -08:00
Guillermo Rauch
d3dde130b7 package: bump engine.io 2016-01-10 22:27:44 -08:00
Damien Arrachequesne
899de7f873 Document type change of Socket#rooms 2016-01-09 22:08:30 +01:00
Damien Arrachequesne
580100d491 Bump dev dependencies 2016-01-07 22:59:28 +01:00
Damien Arrachequesne
acb9cb421d Add badges showing dependency status 2016-01-07 22:58:59 +01:00
Faizal Pribadi
abe2394a24 fix typo word :)
update docs source code
2015-12-20 16:16:42 +07:00
Hongcai Deng
7012ba6c64 fix wrong jsdoc 2015-12-14 15:31:42 +08:00
10 changed files with 74 additions and 38 deletions

1
.gitignore vendored
View File

@@ -9,3 +9,4 @@ lib-cov
benchmarks/*.png
node_modules
coverage
.idea

View File

@@ -1,4 +1,14 @@
1.4.5 / 2016-01-26
==================
* fix closing the underlying `http.Server`
1.4.4 / 2016-01-10
==================
* package: bump `engine.io`
1.4.3 / 2016-01-08
==================
@@ -41,6 +51,7 @@
* package: bump `has-binary` to work with all objects (fixes #1955)
* fix origin verification default https port [evanlucas]
* support compression [nkzawa]
* changed type of `Client#sockets`, `Namespace#sockets` and `Socket#rooms` to maps (instead of arrays)
1.3.7 / 2015-09-21
==================

View File

@@ -2,6 +2,8 @@
# socket.io
[![Build Status](https://secure.travis-ci.org/socketio/socket.io.svg)](https://travis-ci.org/socketio/socket.io)
[![Dependency Status](https://david-dm.org/socketio/socket.io.svg)](https://david-dm.org/socketio/socket.io)
[![devDependency Status](https://david-dm.org/socketio/socket.io/dev-status.svg)](https://david-dm.org/socketio/socket.io#info=devDependencies)
![NPM version](https://badge.fury.io/js/socket.io.svg)
![Downloads](https://img.shields.io/npm/dm/socket.io.svg?style=flat)
[![](http://slack.socket.io/badge.svg?)](http://slack.socket.io)
@@ -299,9 +301,10 @@ server.listen(3000);
clients. A `Socket` belongs to a certain `Namespace` (by default `/`)
and uses an underlying `Client` to communicate.
### Socket#rooms:Array
### Socket#rooms:Object
A list of strings identifying the rooms this socket is in.
A hash of strings identifying the rooms this socket is in, indexed by
room name.
### Socket#client:Client

View File

@@ -16,7 +16,7 @@ module.exports = Client;
* Client constructor.
*
* @param {Server} server instance
* @param {Socket} connection
* @param {Socket} conn
* @api private
*/
@@ -54,7 +54,7 @@ Client.prototype.setup = function(){
/**
* Connects a client to a namespace.
*
* @param {String} namespace name
* @param {String} name namespace
* @api private
*/
@@ -133,7 +133,7 @@ Client.prototype.close = function(){
* Writes a packet to the transport.
*
* @param {Object} packet object
* @param {Object} options
* @param {Object} opts
* @api private
*/
@@ -200,7 +200,7 @@ Client.prototype.ondecoded = function(packet) {
/**
* Handles an error.
*
* @param {Objcet} error object
* @param {Object} err object
* @api private
*/

View File

@@ -5,7 +5,6 @@
var http = require('http');
var read = require('fs').readFileSync;
var parse = require('url').parse;
var engine = require('engine.io');
var client = require('socket.io-client');
var clientVersion = require('socket.io-client/package').version;
@@ -30,8 +29,8 @@ var clientSource = read(require.resolve('socket.io-client/socket.io.js'), 'utf-8
/**
* Server constructor.
*
* @param {http.Server|Number|Object} http server, port or options
* @param {Object} options
* @param {http.Server|Number|Object} srv http server, port or options
* @param {Object} opts
* @api public
*/
@@ -54,8 +53,8 @@ function Server(srv, opts){
/**
* Server request verification function, that checks for allowed origins
*
* @param {http.IncomingMessage} request
* @param {Function} callback to be called with the result: `fn(err, success)`
* @param {http.IncomingMessage} req request
* @param {Function} fn callback to be called with the result: `fn(err, success)`
*/
Server.prototype.checkRequest = function(req, fn) {
@@ -87,7 +86,7 @@ Server.prototype.checkRequest = function(req, fn) {
/**
* Sets/gets whether client code is being served.
*
* @param {Boolean} whether to serve client code
* @param {Boolean} v whether to serve client code
* @return {Server|Boolean} self when setting or value when getting
* @api public
*/
@@ -140,7 +139,7 @@ Server.prototype.set = function(key, val){
/**
* Sets the client serving path.
*
* @param {String} pathname
* @param {String} v pathname
* @return {Server|String} self when setting or value when getting
* @api public
*/
@@ -154,7 +153,7 @@ Server.prototype.path = function(v){
/**
* Sets the adapter for rooms.
*
* @param {Adapter} pathname
* @param {Adapter} v pathname
* @return {Server|Adapter} self when setting or value when getting
* @api public
*/
@@ -173,7 +172,7 @@ Server.prototype.adapter = function(v){
/**
* Sets the allowed origins for requests.
*
* @param {String} origins
* @param {String} v origins
* @return {Server|Adapter} self when setting or value when getting
* @api public
*/
@@ -243,7 +242,7 @@ Server.prototype.attach = function(srv, opts){
/**
* Attaches the static file serving.
*
* @param {Function|http.Server} http server
* @param {Function|http.Server} srv http server
* @api private
*/
@@ -293,7 +292,7 @@ Server.prototype.serve = function(req, res){
/**
* Binds socket.io to an engine.io instance.
*
* @param {engine.Server} engine.io (or compatible) server
* @param {engine.Server} engine engine.io (or compatible) server
* @return {Server} self
* @api public
*/
@@ -307,7 +306,7 @@ Server.prototype.bind = function(engine){
/**
* Called with each incoming transport connection.
*
* @param {engine.Socket} socket
* @param {engine.Socket} conn
* @return {Server} self
* @api public
*/
@@ -322,8 +321,8 @@ Server.prototype.onconnection = function(conn){
/**
* Looks up a namespace.
*
* @param {String} nsp name
* @param {Function} optional, nsp `connection` ev handler
* @param {String} name nsp name
* @param {Function} fn optional, nsp `connection` ev handler
* @api public
*/

View File

@@ -104,7 +104,7 @@ Namespace.prototype.use = function(fn){
* Executes the middleware for an incoming client.
*
* @param {Socket} socket that will get added
* @param {Function} last fn call in the middleware
* @param {Function} fn last fn call in the middleware
* @api private
*/
@@ -260,7 +260,7 @@ Namespace.prototype.clients = function(fn){
/**
* Sets the compress flag.
*
* @param {Boolean} if `true`, compresses the sending data
* @param {Boolean} compress if `true`, compresses the sending data
* @return {Socket} self
* @api public
*/

View File

@@ -88,7 +88,7 @@ flags.forEach(function(flag){
});
/**
* `request` engine.io shorcut.
* `request` engine.io shortcut.
*
* @api public
*/
@@ -199,7 +199,7 @@ Socket.prototype.write = function(){
* Writes a packet.
*
* @param {Object} packet object
* @param {Object} options
* @param {Object} opts options
* @api private
*/
@@ -214,7 +214,7 @@ Socket.prototype.packet = function(packet, opts){
* Joins a room.
*
* @param {String} room
* @param {Function} optional, callback
* @param {Function} fn optional, callback
* @return {Socket} self
* @api private
*/
@@ -239,7 +239,7 @@ Socket.prototype.join = function(room, fn){
* Leaves a room.
*
* @param {String} room
* @param {Function} optional, callback
* @param {Function} fn optional, callback
* @return {Socket} self
* @api private
*/
@@ -338,7 +338,7 @@ Socket.prototype.onevent = function(packet){
/**
* Produces an ack callback to emit with an event.
*
* @param {Number} packet id
* @param {Number} id packet id
* @api private
*/
@@ -409,7 +409,7 @@ Socket.prototype.onerror = function(err){
* Called upon closing. Called by `Client`.
*
* @param {String} reason
* @param {Error} optional error object
* @throw {Error} optional error object
* @api private
*/
@@ -428,7 +428,7 @@ Socket.prototype.onclose = function(reason){
/**
* Produces an `error` packet.
*
* @param {Object} error object
* @param {Object} err error object
* @api private
*/
@@ -439,7 +439,7 @@ Socket.prototype.error = function(err){
/**
* Disconnects this client.
*
* @param {Boolean} if `true`, closes the underlying connection
* @param {Boolean} close if `true`, closes the underlying connection
* @return {Socket} self
* @api public
*/
@@ -458,7 +458,7 @@ Socket.prototype.disconnect = function(close){
/**
* Sets the compress flag.
*
* @param {Boolean} if `true`, compresses the sending data
* @param {Boolean} compress if `true`, compresses the sending data
* @return {Socket} self
* @api public
*/

View File

@@ -1,6 +1,6 @@
{
"name": "socket.io",
"version": "1.4.3",
"version": "1.4.5",
"description": "node.js realtime framework server",
"keywords": [
"realtime",
@@ -21,20 +21,20 @@
"test": "mocha --reporter dot --slow 200ms --bail"
},
"dependencies": {
"engine.io": "1.6.6",
"engine.io": "1.6.8",
"socket.io-parser": "2.2.6",
"socket.io-client": "1.4.3",
"socket.io-client": "1.4.5",
"socket.io-adapter": "0.4.0",
"has-binary": "0.1.7",
"debug": "2.2.0"
},
"devDependencies": {
"expect.js": "0.3.1",
"istanbul": "0.2.3",
"istanbul": "0.4.1",
"mocha": "2.3.4",
"superagent": "0.17.0",
"supertest": "0.8.2",
"zuul-ngrok": "3.1.0"
"superagent": "1.6.1",
"supertest": "1.1.0",
"zuul-ngrok": "3.2.0"
},
"contributors": [
{

11
test/fixtures/server-close.js vendored Normal file
View File

@@ -0,0 +1,11 @@
var server = require('http').createServer();
var ioc = require('socket.io-client');
var io = require('../..')(server);
var srv = server.listen(function() {
var socket = ioc('ws://localhost:' + server.address().port);
socket.on('connect', function() {
io.close();
socket.close();
});
});

View File

@@ -3,6 +3,7 @@ var http = require('http').Server;
var io = require('..');
var fs = require('fs');
var join = require('path').join;
var exec = require('child_process').exec;
var ioc = require('socket.io-client');
var request = require('supertest');
var expect = require('expect.js');
@@ -412,6 +413,16 @@ describe('socket.io', function(){
});
});
describe('graceful close', function(){
function fixture(filename) {
return process.execPath + ' ' +
join(__dirname, 'fixtures', filename);
}
it('should stop socket and timers', function(done){
exec(fixture('server-close.js'), done);
});
});
});
describe('namespaces', function(){