@outspeed/react
Connecting to a Websocket backend
The useWebSocket hook simplify the process of connecting to Outspeed’s WebSocket backend.
We assume you have already deployed your backend. If not, please follow this tutorial to deploy your backend with
outspeed-client
.The code shown establishes a socket connection with the backend and streams local audio.
- We import the necessary components from the
@outspeed/react
. useWebSocket
: This hook is used to manage WebSocket connections. To learn more aboutuseWebSocket
visit here.- Configuration: The
useWebSocket
hook is configured with a URL (functionURL) and options to enable audio with echo cancellation. - Audio Stream: The RealtimeAudio component is used to play the remote audio stream.
Resources
Was this page helpful?