Streaming
Last updated
Last updated
Using WebSockets provides the ability to stream responses back to a client in order to allow partial results for certain requests. This improves the perceived responsiveness of applications and offers a better user experience.
The WebSocket url is https://api.lingoblocks.com
.
Stream a message response back to a client as it's being generated.
WebSocket URL: https://api.lingoblocks.com
Requirements:
accessToken
: The existing access token for the session (see ).
socket.io-client
: WebSocket client library (see ).
Import socket.io-client
to create a WebSocket connection.
Initialize socket connection.
Listen for messages on the message
event.
Filter messages by checking if the event data matches chatbot.responseGenerated
.
Process the streamed message data.