socketio-auth
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -16,3 +16,3 @@ 'use strict'; | ||
* @param {Number} [config.timeout=1000] - amount of millisenconds to wait for a client to | ||
* authenticate before disconnecting it | ||
* authenticate before disconnecting it. A value of 'none' means no connection timeout. | ||
*/ | ||
@@ -57,9 +57,11 @@ module.exports = function socketIOAuth(io, config) { | ||
setTimeout(function() { | ||
// If the socket didn't authenticate after connection, disconnect it | ||
if (!socket.auth) { | ||
debug('Disconnecting socket %s', socket.id); | ||
socket.disconnect('unauthorized'); | ||
} | ||
}, timeout); | ||
if (timeout !== 'none') { | ||
setTimeout(function() { | ||
// If the socket didn't authenticate after connection, disconnect it | ||
if (!socket.auth) { | ||
debug('Disconnecting socket %s', socket.id); | ||
socket.disconnect('unauthorized'); | ||
} | ||
}, timeout); | ||
} | ||
@@ -66,0 +68,0 @@ }); |
{ | ||
"name": "socketio-auth", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Authentication for socket.io", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,2 +0,2 @@ | ||
# socketio-auth [![Build Status](https://secure.travis-ci.org/invisiblejs/socketio-auth.png)](http://travis-ci.org/invisiblejs/socketio-auth) | ||
# socketio-auth [![Build Status](https://secure.travis-ci.org/facundoolano/socketio-auth.png)](http://travis-ci.org/facundoolano/socketio-auth) | ||
@@ -79,3 +79,3 @@ This module provides hooks to implement authentication in [socket.io](https://github.com/Automattic/socket.io) without using querystrings to send credentials, which is not a good security practice. | ||
* `timeout`: The amount of millisenconds to wait for a client to authenticate before disconnecting it. Defaults to 1000. | ||
* `timeout`: The amount of millisenconds to wait for a client to authenticate before disconnecting it. Defaults to 1000. The value 'none' disables the timeout feature. | ||
@@ -82,0 +82,0 @@ ## Auth error messages |
15711
241