wsoop
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

wsoop

npm version dependencies Status devDependencies Status Travis Coverage Status

Framework for developing efficient WebSocket server applications.

Installation

$ npm install --save wsoop

Usage (< ES2015)

Create applicaton using the Server class.

var wsoop = require('wsoop');
var app = new wsoop.Server();

...

app.listen(5000);

Add actions (routes) to the application.

var myAction = new wsoop.Action()
  .add('hello', () => {
    // world!
  });

app.add(myAction);

Usage (>= ES2015)

You can directly import Server and Action class from wsoop package.

import { Server, Action } from 'wsoop';

Class and Decorators

You can use ES2015 classes and decorators to define actions.

import { bind } from 'wsoop';

class MyAction {
  @bind('message')
  onMessage() {
    //
    // New message from socket
    // TODO: do some stuff here
    //
  }
}

More examples will be available soon...

Verbose

You can set environment variable to display verbose log messages.

$ DEBUG=ws:* node myApp.js

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.1
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.2.1
    0
  • 0.2.0
    1
  • 0.1.2
    1
  • 0.1.1
    1

Package Sidebar

Install

npm i wsoop

Weekly Downloads

3

Version

0.2.1

License

MIT

Last publish

Collaborators

  • ibrahimduran