Let’s begin with the Voximplant side. Log into your account at https://manage.voximplant.com/auth. On the left menu, select Applications, click New application and create one. Let’s name it websocket. After that, go to your new application, switch to the Scenarios tab, and create a scenario containing the following code:
This VoxEngine scenario sends an audio stream to the WebSocket and listens to the WebSocket events (ERROR, CLOSE, OPEN, MESSAGE). We’ll go into the scenario’s details later.
As for now, let’s switch to the Routing tab of your websocket application and click New rule. Give it a name, assign your JS scenario to it, and leave the default call pattern ( .* ).
And the last but not the least thing is to create a user for the application. Switch to the Users tab, click Create user, set a username (e.g., socketUser) and password, and click Create. We’ll need this login-password pair to authenticate in the web client.
The configuration is ready, but first, let’s dive into how the WebSocket module works in our scenario.