Squawk is a realtime broadcast which includes important headlines, price movement and rumors as stories develop to give traders and investors news in the fastest and most convenient form.
UUID
string used to coordinate messages between client and server over WebSocket.
Response
appended at the end of the message’s type sent. For e.g. a message with type joinRoom
will receive a response with type joinRoomResponse
apikey
), please get in touch with the Benzinga licensing team at licensing@benzinga.com. This is a one-time process. Save this API key securely.
Using JWT
Benzinga APIs support asymmetric JWT (JSON Web Token) for authentication.
To authenticate using JWT, send the token in query parameter when you open the WebSocket connection. Pseudo-code for connecting (and authenticating) would be as below:
iceServers
details, authentication is done. Next, send the join room request/message. The room name for benzinga broadcasts is PRO
. Sample join room request format:
existingPresenters
represents active broadcasters at the moment.
allowedListening
and allowedBroadcasting
indicates if this user has listening and broadcasting rights to the channel.
restart
flag is used to indicate if there needs a peer re-negotiation (ICE Restart) for a stream. This should be used in case of peer connection is failing for any reason (e.g. change in network). It is optional if you are creating a new peer connection. A successful response should have SDP offer for subscribed stream:
startStrea
request to start receiving and listening.
iceCandidate
from each stream’s peer:
complete
state (when ICE gathering completed), send the following request to notify same:
stopStream
request.
subscribeToStream
on an existing peer connection fail event (meaning you are starting over again), then you must invoke stopStream
first to dispose of the existing peer connection before a fresh subscribeToStream
mediaOverride
notification will be in the following format:
ping
messages to keep the Web Socket connection alive. Every 25-30 seconds should be good enough. Ping request format:
id
:
rtp-receiver
example. 5 open ports are more than enough.
apikey
.
apiKey
. This is a one-time process. Save this API key securely.
Join Room
Once authenticated, send the join room request/message. The room name for benzinga broadcasts is PRO
. Sample join room request format:
existingPresenters
represents active broadcasters at the moment. So if there are any existing broadcasters, you should start SDP negotiation with each broadcaster to receive the audio stream.
userId
received in a presenter object. Sample format as shown below:
sdpAnswer
can be useful if you are aiming to re-broadcast the stream via WebRTC through any media server on your end. If not then simply ignore that. At this point, after successful SDP negotiation, you should start receiving RTP audio stream from Squawk.
presenterLeft
message will be received in below format:
ping
messages to keep the Web Socket connection alive. Every 25-30 seconds should be good enough. Ping request format: