This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

smokeweed

1.0.4 • Public • Published

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');
});

Package Sidebar

Install

npm i smokeweed

Weekly Downloads

1

Version

1.0.4

License

BSD-2-Clause

Last publish

Collaborators

  • hungluu