flowthings-browser-client
Install
NPM
npm install flowthings-browser
Bower
bower install flowthings-browser
Example
var path = '/my/flow/path';var api = flowthings; // Connect to WebSocketsapiws; // Subsribe to Dropsapiws; { console;} // Query for the Flowapiflow;
Configuration
flowthings.API(config)
account
token
WebSockets
api.ws.connect([callback])
Initiates a WebSocket connection.
api.ws.subscribe(flowIdOrPath, handler[, callback])
Subscribes to the provided Flow and invokes the handler when receiving Drops.
api.ws.unsubscribe(flowIdOrPath, handler[, callback])
Unsubscribes the provided handler from the Flow.
api.ws.send(command[, callback])
Sends arbitrary commands through the WebSocket API.
REST
api.flow.read(flowId[, params], callback)
api.flow.findMany(params, callback)
api.flow.find(..., callback)
Overloaded find method, dispatched on first argument.
api.drop.create(drop[, callback])
api.drop(flowId).create(drop[, callback])
api.drop(flowId).update(drop[, callback])
api.drop(flowId).save(...[, callback])
Overloaded save method, dispatched on first argument.
api.drop(flowId).read(dropId[, params], callback)
api.drop(flowId).findMany(params, callback)
api.drop(flowId).find(..., callback)
Overloaded find method, dispatched on first argument.
api.drop(flowId).aggregate(spec[, params], callback)
Aggregation spec options:
filter
groupBy
rules
output
sorts
Please visit the flowthings.io aggregation documentation for more details on how to use these options.
Promises
Anything that takes a callback can return a Promise
instead by using the
promisify
transform when creating your API
. Just provide your promise
implementation of choice.
var api = flowthings; // Query for a Flowapiflow ;