Nimble's WebSocket API (Application Programming Interface) enables users to subscribe to real-time streaming data and events. Behind this API is a software layer that routes data, arbitrates resources and executes Deep Learning and analytics functions to enable enriched business insights at world-class speed.
The latest online documentation can be found here.
Nimble and the WebSocket API have six key elements: Configuration, Source, Sink, Pipeline, Channel, and Stream.
A Configuration is a collection of Sources, Sinks and Pipeline Elements arranged to execute the desired analytic behavior.
A Source brings data into Nimble.
A Sink pushes data out of Nimble.
A Pipeline is made up of processing elements that perform some analytics task.
Since a Source can be shared between multiple Pipelines, a Channel is an abstraction of both a Source and a Pipeline that can be thought of as "the data brought in by this Source is operated on by this Pipeline".
A Stream is a proxied fMP4 video stream from a Source.
There are three WebSocket topic categories:
Notification events for changes to the Configuration.
Specify which events to subscribe to.
Accepts the following message:
Subscribe or unsubscribe from Configuration events.
Enable all events.
Enable only Source events.
{
"source": true
}
Disable Source and enable Pipeline events.
{
"source": false,
"pipeline": true
}
Disable all events (verbose).
{
"source": false,
"pipeline": false,
"sink": false
}
Notification events for changes to the Configuration.
Open a WebSocket connection to receive notification events for changes in the Configuration.
Accepts the following message:
Global Configuration change notification.
Live video Source created.
{
"type": "source",
"action": "created",
"value": {
"id": 2,
"type": "video",
"address": "rtsp://localhost:554/axis-media/media.amp",
"rate": 30
}
}
Live video Source updated (address and rate).
{
"type": "source",
"action": "updated",
"value": {
"id": 2,
"type": "video",
"address": "rtsp://localhost:8554/h264major",
"rate": 15
}
}
Live video Source stats updated.
{
"type": "source",
"action": "stats",
"value": {
"id": 2,
"status": "running",
"fps": 15,
"latency": 12.85
}
}
Live video Source deleted.
{
"type": "source",
"action": "deleted",
"value": {
"id": 2
}
}
File Sink created.
{
"type": "sink",
"action": "created",
"value": {
"id": 1,
"type": "file",
"address": "./output.mp4",
"filter": []
}
}
File Sink updated (address and filter).
{
"type": "sink",
"action": "updated",
"value": {
"id": 1,
"type": "file",
"address": "./new_output.mp4",
"filter": [
2
]
}
}
File Sink stats updated.
{
"type": "sink",
"action": "stats",
"value": {
"id": 1,
"status": "running",
"fps": 14.8,
"latency": 147.2
}
}
File Sink deleted.
{
"type": "sink",
"action": "deleted",
"value": {
"id": 1
}
}
Pipeline created.
{
"type": "pipeline",
"action": "created",
"value": {
"id": 0,
"elements": [
{
"name": "infer",
"args": {
"model": "person-detection-nano",
"score_threshold": 0.3,
"iou_threshold": 0.3
}
},
{
"name": "object-tracking-OH",
"args": {
"max_age": 3,
"min_hits": 3,
"history": 50,
"region": "bottom",
"ratio": 0.2,
"moving_average": 3
}
}
],
"usecase": "my-usecase",
"sources": [
2
],
"sinks": [
1
]
}
}
Pipeline updated (usecase and sinks).
{
"type": "pipeline",
"action": "updated",
"value": {
"id": 0,
"elements": [
{
"name": "infer",
"args": {
"model": "person-detection-nano",
"score_threshold": 0.3,
"iou_threshold": 0.3
}
},
{
"name": "object-tracking-OH",
"args": {
"max_age": 3,
"min_hits": 3,
"history": 50,
"region": "bottom",
"ratio": 0.2,
"moving_average": 3
}
}
],
"usecase": "new-usecase",
"sources": [
2
],
"sinks": []
}
}
Pipeline stats updated.
{
"type": "pipeline",
"action": "stats",
"value": {
"id": 0,
"status": "running",
"fps": 14.9,
"latency": 122.67
}
}
Pipeline deleted.
{
"type": "pipeline",
"action": "deleted",
"value": {
"id": 0
}
}
Publish data directly to a Source.
Note: This endpoint is only valid for Sources that support publishing.
The ID of the Source to publish to.
Accepts the following message:
Note: The Source defines the payload format of the published data.
string
Notification events for changes to the Exports.
Specify which events to subscribe to.
Accepts the following message:
Subscribe or unsubscribe from events.
Enable all events.
Enable only Channel events.
{
"channel": true
}
Disable Channel and enable Stream events.
{
"channel": false,
"stream": true
}
Disable all events (verbose).
{
"channel": false,
"stream": false
}
Notification events for changes to the Exports.
Open a WebSocket connection to receive notification events for changes to the Exports.
Accepts the following message:
Exports changed notification
Stream created.
{
"type": "stream",
"action": "created",
"value": {
"id": 0,
"sources": [
2
]
}
}
Channel created.
{
"type": "channel",
"action": "created",
"value": {
"id": 1,
"source": 2,
"pipeline": 3,
"stream": 0
}
}
Channel deleted.
{
"type": "channel",
"action": "deleted",
"value": {
"id": 1
}
}
Stream deleted.
{
"type": "stream",
"action": "deleted",
"value": {
"id": 0
}
}
Multi-Channel metadata streaming.
Specify which channels to subscribe to.
Accepts the following message:
Specify which Channels to subscribe to.
Enable all Channels.
Enable only Channels 0 and 1.
[
0,
1
]
Disable Channel 1.
[
1
]
Multi-Channel metadata streaming.
Receive JSON metadata from all inferencing Channels.
Accepts the following message:
Metadata for a frame of video extracted by the inferencing Channel.
[
0,
{}
]
Multi-Channel event notification.
Specify which channels to subscribe to.
Accepts the following message:
Specify which Channels to subscribe to.
Enable all Channels.
Enable only Channels 0 and 1.
[
0,
1
]
Disable Channel 1.
[
1
]
Multi-Channel event notification.
Receive notification events for updates to Channels.
Accepts the following message:
Channel statistics changed notification.
FPS changed event (for Channel 0).
{
"id": 0,
"type": "fps",
"value": 29.2
}
Latency changed event (for Channel 1).
{
"id": 1,
"type": "latency",
"value": 134.1
}
Channel metadata streaming.
Configure the channel metadata stream.
The ID of the Channel to connect to.
Accepts the following message:
Configuration object to dynamically change connection behavior.
Set 'live' status to expire after 10 seconds.
{
"live_timeout": 10000
}
Send 'live' message from client to maintain 'live' status before timeout is reached.
{
"live": true
}
Set 'live' status to never expire.
{
"live_timeout": 0
}
Set metadata timeout so frames continue to be sent for 5 seconds after the last detection.
{
"metadata_timeout": 5000
}
Only send metadata frames that contain inference/analytics results in the JSON, regardless of previous frames.
{
"metadata_timeout": 0
}
Channel metadata streaming.
Receive JSON metadata from an inferencing Channel.
The ID of the Channel to connect to.
Accepts the following message:
Metadata for a frame of video extracted by the inferencing Channel.
[
{}
]
Channel event notification.
Specify which events to subscribe to.
The ID of the Channel to connect to.
Accepts the following message:
Subscribe or unsubscribe from Channel events.
Enable all events.
Enable FPS events.
{
"fps": true
}
Disable FPS and enable latency events.
{
"fps": false,
"latency": true
}
Disable all events (verbose).
{
"fps": false,
"latency": false
}
Channel event notification.
Receive notification events for updates to specific Channel.
The ID of the Channel to connect to.
Accepts the following message:
Channel statistic changed notification.
FPS changed event.
{
"type": "fps",
"value": 29.2
}
Latency changed event.
{
"type": "latency",
"value": 134.1
}
Video streaming.
Receive a binary stream of fragmented MP4 video.
The ID of the Stream to connect to.
Accepts one of the following messages:
Reset status.
reset
string
Notification events for updates to the Statistics.
Specify which events to subscribe to.
Accepts the following message:
Subscribe or unsubscribe from events.
Enable all events.
Enable only CPU Load events.
{
"cpu": true
}
Disable CPU Load and enable Memory events.
{
"cpu": false,
"memory": true
}
Disable all events (verbose).
{
"cpu": false,
"memory": false
}
Notification events for updates to the Statistics.
Receive notification events for updates to Statistics.
Accepts the following message:
Global statistics changed notification.
Uptime (in seconds).
{
"type": "uptime",
"value": 29.763
}
One CPU thread utilized.
{
"type": "cpu",
"value": 1
}
Half of a CPU thread utilized.
{
"type": "cpu",
"value": 0.5
}
2.5GiB virtual memory and 800MiB physical RAM used. 4GB physical memory on the system with 1GB available.
{
"type": "memory",
"value": {
"virtual": 2684354560,
"physical": 838860800,
"total": 4294967296,
"available": 1073741824
}
}
4Mbps send/receive bandwith used (in bytes per second).
{
"type": "network",
"value": {
"send": 524288,
"receive": 524288,
"congestion": false
}
}
Nimble is activated.
{
"type": "activated",
"value": true
}
Subscribe or unsubscribe from Configuration events.
Global Configuration change notification.
Subscribe or unsubscribe from events.
Exports changed notification
Specify which Channels to subscribe to.
Subscribe or unsubscribe from Channel events.
Channel statistic changed notification.
Channel statistics changed notification.
Metadata for a frame of video extracted by the inferencing Channel.
Metadata for a frame of video extracted by the inferencing Channel.
Subscribe or unsubscribe from events.
Global statistics changed notification.