1.0.4 • Published 8 years ago

smokeweed v1.0.4

Weekly downloads
3
License
BSD-2-Clause
Repository
github
Last release
8 years ago

SmokeWeed


An implementation of ws for ez life - ez websocketing. A holy library for you to write websocket application in minutes while having time to smoke weed :)

Just kidding. This is a library for my personal usage. If you wanna use it, you can follow below instruction:

  1. Install
npm install --save smokeweed
  1. Start websocket server
var smokeweed = require('smokeweed');
var server = smokeweed();
// or everyone has a unique name :)
var server = smokeweed({
    client : smokeweed.namedClient
});
  1. Bind events
server.on('connect', function(client){
    // close, pong, ...
    client.on('close', function(){});
    // send a message to current client
    client.write('title', 'data');
    // listen for a message
    client.read('title', function(data){});
    // write message to another user with his name
    client.write('title', 'data', 'John');
    // broadcasting
    client.broadcast('title', 'data');
});
1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago