node package manager



WebSocket client library for the nydus protocol, a simple RPC/PubSub protocol.

Build Status NPM



import nydusClient from 'nydus-client'

const socket = nydusClient(host[, options])

Create a nydus client and connect it to a particular host. An optional options object can be passed as the second argument. For the list of acceptable options, check the constructor method of



Connect to the server. If already connected, this will be a no-op.

socket.registerRoute(pathPattern, handler)

Register a handler function to respond to PUBLISH messages on a path matching the specified pattern. Handler function is a normal function of the form: function({ route, params, splats }, data)

PUBLISH messages that don't match a route will be emitted as an 'unhandled' event on this object, which can be useful to track in development mode.

socket.invoke(path[, data])

Invoke a remote method on the server, specified via a path. Optionally, data can be specified to send along with the call (will be JSON encoded). A Promise will be returned; resolved or rejected with the result or error, respectively, from the server.


Disconnect from the server. If not already connected, this will be a no-op.