A WebSocket is a protocol for establishing two-way communication streams over the Internet. By using an API for WebSockets you can capture conversation intelligence insights in real-time. Symbl.ai’s Streaming API easily integrates directly into JavaScript WebSocket software, enabling access to conversational AI in real-time conversations.

WebSocket is a protocol that Real-Time Communications (RTC) or Real-Time Engagement (RTE) companies use for establishing two-way or multi-member voice, video, messaging, or broadcast streams over the internet. Many of the most famous RTC/RTE companies, such as Twilio, Vonage, or Agora, use WebSockets for their mobile or browser Software Development Kits (SDK). For example, “Zoom” employs WebSockets as its underlying technology to transfer voice and video at the same time to all participants on the call.

Adding real-time insights to your app with an API

If you have a WebSocket stream set up with one of those companies but don’t know how to record a call, perform live transcription, or run algorithms on the results of a conversation, then you need to use an API. An API for WebSockets enables developers to build voice, video, chat, or broadcast applications, with the ability to capture insights in real-time using artificial intelligence. One API you can use is from Symbl.ai‘s Telephony API, however, Symbl.ai’s Websocket easily integrates directly into JavaScript software to enable real-time conversations.

WebSockets for Symbl.ai

Basic Code for Live Conversation Intelligence with Javascript WebSocket API 3

Basic representation of how WebSockets transfer data.

WebSockets facilitate communications between clients or servers in real time without the connection suffering from sluggish, high-latency, and bandwidth-intensive HTTP API calls. Specified as ws or wss, unencrypted or encrypted, a WebSocket endpoint is a persistent bi-directional communication channel without the overhead of HTTP residuals, such as headers, cookies, or artifacts. Here’s Symbl.ai’s API for WebSockets: wss://api.symbl.ai/v1/realtime/ Due to the full-duplex nature of millisecond-accurate state synchronization, many APIs operate under WebSocket messages from publishers to subscribers. TokBox describes its channel software’s method names entirely from WebSockets’ perspective with subscriber or publisher method names.

Best Practices

Although you can already find a detailed guide on best practices for audio integrations with Symbl, here’s the 101 on adopting Symbl.ai’s real-time WebSocket API.

  • Separate channels per person: Make sure the audio for each person is on a separate channel or over separate WebSocket connections for optimal results.
  • Lossless Codecs: Use FLAC or LINEAR16 codecs, if bandwidth is not an issue, or, if it is, Opus, AMR_WB, or Speex codecs.

How to use Symbl’s JavaScript WebSockets API

To achieve live transcription with Symbl.ai’s JavaScript WebSocket’s API in the browser, all you have to do is:

  1. Set up your account
  2. Configure the WebSocket endpoint
  3. Run the code
  4. Transcribe in real-time.

We’ll go through each step.

1. Set up

Register for an account at Symbl (i.e. https://platform.symbl.ai/). Grab both your appId and your appSecret. With both of these you should authenticate either with a cURL command or with Postman to get your x-api-key. Here’s an example with cURL:

curl -k -X POST "https://api.symbl.ai/oauth2/token:generate"      -H "accept: application/json"      -H "Content-Type: application/json"      -d "{ "type"": ""application""

Avatar photo
Eric Giannini
Lead Developer Evangelist & Advocate