This is a client for rockets/rockets.
Demo
See rockets/demo.
Installation
npm install rockets
Usage
var Rockets = ; var client = ; // Register events on the client.client; client; // Initiate the client's socket connection.client;
Events
Events can be registered with client.on('event', handler)
.
Event | Arguments | Description |
---|---|---|
connect | Connection to the server has been established | |
disconnect | Connection to the server has been lost | |
error | error | Error has occurred |
model | model | Received model, either post or comment |
comment | model | Received a comment |
post | model | Received a post |
Functions
Name | Arguments | Description |
---|---|---|
subscribe | channel, [include [, exclude]] | Subscribes to a channel, with optional include and exclude rules |
available | Returns true if the socket connection is open |
|
close | Close the connection to the server |
Credits
Illustrations by Ken Samonte.