0.1.1 • Published 10 years ago

limb v0.1.1

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

limb

tcp heartbeat connection tool

Model

One server, many clients

clients tell server about themselves

events for changes in connectivity

JSON configuration is transferred once, heartbeats continue passing smaller data

server

var limb = require('limb')

limb.listen(7000)
  
limb.on('client', function(client) {
  // do stuff with newly client
})

limb.on('drop', function(client) {
  // do stuff with dropped client
})

client

var limb = require('limb')

// whatever you put as the info property 
// will be viewable on the server with the .getAll() method
limb.info = {
   arbitrary: "values"
}

limb.connect(7000, 'localhost')

Methods

###limb#getAll()

returns array of connected clients

###limb#listen(port)

start net server running on port

###limb#connect(info, port, host)

Events

server: 'client'

emitted when a client connects to the server and a duplex handshake has been established

limb.on('client', function(client) {
  console.log('got a new client!')
  console.log(client)
})

server 'drop'

emitted when a client connection is closed

limb.on('drop', function(dropped) {
  console.log('dropped a client:')
  console.log(dropped)
})

Similar Stuff

throb

pingdom

0.1.1

10 years ago

0.1.0

10 years ago

0.0.1

10 years ago