package
snapper consumer client for node.js and browser.
npm install snapper-consumerGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
snapper consumer client for node.js and browser.
Snapper-consumer is tested in snapper-core
# module: socket.coffee
define((require, exports, module) ->
Backbone = require('backbone')
Consumer = require('consumer')
http = require('lib/http-thunks')
class SocketClient extends Consumer
broooooklyn
lynweklm@gmail.com
var Consumer = require('snapper-consumer')new Consumer([url][, options])var consumer = new Consumer()url: String, Snapper server host.options: Object, engine.io-client options, but added options.token.consumer.prototype.onopen()consumer.prototype.onclose()consumer.prototype.onerror(error)error: Error Object.Default error listener, overwrite it in production.
consumer.prototype.onmessage(event)event.id: String|Number|null|undefined, JSON-RPC idevent.data: Object, JSON-RPC object.event.type: String, JSON-RPC type, 'invalid', 'notification', 'success', 'error', 'request'.Default messages listener, overwrite it in production.
consumer.prototype.getToken()Default getToken, overwrite it in production.
Consumer.prototype.getToken = function () {
return this.options.token
}consumer.prototype.request(method[, params][, callback])method: String, JSON-RPC request method.params: Mixed, JSON-RPC request params.callback: function, response callback.Send a JSON-RPC request to server.
consumer.prototype.join(room), consumer.prototype._join(room, consumerId)room: String, room name._join method should be implemented for this method.
consumer.prototype._respond(event)It is used to respond server's request.
consumer.prototype.connect([url][, options])url: String, Snapper server host.options: Object, engine.io-client options, but added options.token.Connect to server. The arguments is the same as constructor, should be provided in constructor or here.
consumer.prototype.close()Close the client.
Estimated unpacked size across 9 packages.
1.2 MB
Includes dependencies.