very simple utilities to get information from a socket.io (v1.0.0+) connection
$ npm install --save socket-utils$ npm test$ npm run cover| Name | Type | Description |
|---|---|---|
| socket | socket.io.Socket |
A connected socket object |
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'
// => }
// => }
})
})