Let Symbl.ai take care of WebSocket connections
WebSocket is a communications protocol, where a bi-directional handshake is established between the client and server. Handling this handshake process and network related issues is a tiresome task. Further, the effort spent to do so distracts developers from developing core application functionality. Symbl.ai’s Web SDK takes care of the WebSocket connections within the Symbl.ai platform, in line with the RFC 6455 standardized approach. Apart from the standard threshold limits, simple configurations are provided for developers where they can set their own timeout thresholds. Managing multiple WebSocket connections is also easy with the Web SDK by creating multiple instances ofSymbl()
object.
Handle audio from all your devices
In web applications that capture and process live audio from end users who are speaking, it is common for end users to switch between devices such as from a laptop microphone to a headset. These device changes modify the baseline processing parameters for the audio data and must be reflected so Symbl.ai can adapt to the correct configurations. Symbl.ai’s Web SDK handles all of these device issues. Web SDK supports a wide range of audio codecs (OPUS & Linear16) and sample rates (8kHz, 16kHz, 24kHz, 44.1kHz, 48kHz). Web SDK also has an automatic device handling mechanism that takes care of updating codec and sample rates appropriately whenever input audio devices are switched. Developers can also now input custom audio streams with only a few lines of code.Hello World application for Web SDK: Try it out
Let’s look at how this works in the example below. A prerequisite to utilize the Web SDK is to ensure that you have your API Credentials which are the App ID and App Secret handy. You can get them from the Symbl.ai Platform. Alternatively, you can use your access token for authentication as well, see the Authentication page to learn more.Symbl.ai SDK Step-by-Step
Import the SDK from@symblai/symbl-web-sdk
and initialize it with your App ID and App Secret. Start creating a web socket connection with the createConnection()
. This method
will establish a bi-directional handshake between your client and Symbl.ai’s server, thus creating a web socket connection. Configure your request with a wide range of input parameters. To learn more, take a look here.
import { Symbl } from "@symblai/symbl-web-sdk";
try {
const symbl = new Symbl();
await symbl.init({
appId: '',
appSecret: '',
});
const connection = await symbl.createConnection();
await connection.startProcessing({
config: {
encoding: "OPUS"
}
});
await symbl.wait(10000);
await connection.stopProcessing();
await connection.disconect();
} catch(e) {
// Handle errors here.
}
Time to get started
To learn more about how Web SDK helps you to build applications, check out our full documentation as well as our GitHub repo. Also if you have not already, you can sign up for a Symbl.ai account here.