WebSocket Flow Subscribe

WebSockets is a "push" based transport mechanism, and so you can subscribe to particular Flows and receive all Drops in realtime. This is not possible using the HTTP REST API.

Example

{
  "msgId": "my-request",
  "object": "drop",
  "type": "subscribe",
  "flowId": "f53b1d1600cf27b75148de0ac"
}

You can also use the path instead of the flowId:

{
  "msgId": "my-request",
  "object": "drop",
  "type": "subscribe",
  "path": "/my/flow/path"
}

Response


Example

{
  "head": {
    "msgId": "my-request",
    "ok": true,
    "errors": [],
    "messages": [ "Your request has been processed successfully." ]
  },
  "body": {}
}

Incoming Drops


When a Drop is sent to the specified Flow, it will be delivered in the following message format:

{
  type : "message",
  resource : "f53b1d1600cf27b75148de0ac",
  value : {
    // <... Drop object here ...>
    }
}

Unsubscribe


To unsubscribe from a flow, just send the same message with the type "unsubscribe," instead of subscribe.

Example

{
  "msgId": "my-request",
  "object": "drop",
  "type": "unsubscribe",
  "flowId": "f53b1d1600cf27b75148de0ac"
}