Commit Detail
Commit a2092dc
WebSocket support in AI Binding Workers AI is extending its AI binding to allow users to establish a WebSocket connection with supported models, enabling real-time, bi-directional inference requests. The code for ai.run() method is refactored to have separate flows for generating a regular fetch call, a readable stream fetch and one for supporting websockets. There is a new AiOptions called "websocket", a boolean value that will help establish a connection to the model using the Upgrade header. The WebSocket will be returned to the calling code as-is and the user can add event listeners to send and receive inference requests. Tests are trivial as they currently only check if the headers were parsed correctly along with the body.