0.1.0 • Published 10 years ago

socket-utils v0.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
10 years ago

gaw-socket-utils

build status

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
NameTypeDescription
socketsocket.io.SocketA 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'
    // =>   }
    // => }
  })
})
0.1.0

10 years ago