Open a new streaming session

The first step when using the streaming API is for the client to open a new streaming session based on a secure Websocket connection. The connection can be established by a websocket client on the following address:

wss://live.behavioralsignals.com/stream/{cid}

The cid path parameter is the client id created and provided to the client after their account is set up. Some additional parameters must be provided when opening the connection, so the service can identify the user and allow the session to start. These are listed in the following table:

Name

Required

Type

Short Description

X-Auth-Token

YES

string

Token for authentication

The query parameter X-Auth-Token must contain the token that identifies your current account in the service.

If your client supports header parameters, you can alternatively provide your token using a header parameter with the same name: X-Auth-Token. The header parameter method is encouraged, whenever possible.

The client must assign handlers to the default websocket events of onOpen, onMessage, onClose and onError. After the successful connection establishment, the service will respond with a message to let the user know that it is ready to accept a new processing request. If the service is under heavy load, it will provide a message with a time estimate in seconds of when the service will be ready.

Status

Respose

Ready

{‘status’ : ‘ready’}

Loaded

{‘status’: ‘loaded’, ‘delay’:’120’}


Did this page help you?