README
gaw-socket-utils
very simple utilities to get information from a socket.io (v1.0.0+) connection
Install
$ npm install --save socket-utils
Tests
$ npm test
Coverage
$ npm run cover
API
utils.socketInfo()
Params
Name | Type | Description |
---|---|---|
socket | socket.io.Socket |
A connected socket object |
Example
io.on('connection', function(socket) {
socket.on('info', function() {
var info = utils.socketInfo(this)
console.log(info)
// => {
// => user: { id: 1, name: 'Evan' },
// => address: '127.0.0.1',
// => headers: {
// => connection: 'keep-alive',
// => 'user-agent': 'blah blah'
// => }
// => }
})
})