Socket
Book a DemoInstallSign in
Socket

websocket-rpc-stream

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

websocket-rpc-stream

RPC over websockets with status updates.

unpublished
latest
npmnpm
Version
0.0.15
Version published
Maintainers
1
Created
Source

websocket-rpc-stream

RPC over websockets with status updates.

Installation

Component

component install manuelstofer/websocket-rpc-stream

NPM

npm install websocket-rpc-stream

API

Do a RPC call:

var RpcStream = require('websocket-rpc-stream'),
    rpc       = new RpcStream({ socket: websocket }),
    stream    = rpc.call('create hurricane', { amount: 100 });

stream.on('progress', function (progress) {
    console.log(progress);
});

stream.on('done', function (result) {
    console.log(result);
});

Handle RPC calls:

var RpcStream = require('websocket-rpc-stream'),
    rpc       = new RpcStream({ socket: websocket }),

rpc.on('create hurricane', function (options, stream) {

    var butterfly  = new Butterfly(),
        hurricanes = [];

    for (var i = 0; i < options.amount; i++) {
        var hurricane = butterfly.flap();
        hurricanes.push(hurricane);

        stream.progress(i);
    }

    stream.done(hurricanes);
});

Keywords

websocket

FAQs

Package last updated on 23 Mar 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts