import { type Socket } from "https://deno.land/x/cav@0.0.21/mod.ts";
Cav's WebSocket wrapper interface.
Properties
Send data to the connected party. The data provided is serialized using the
top-level serialize()
function.
Methods
Register an event listener for the "open" event, which is fired when the web socket connection is established. The socket must be opened before any data can be sent.
Register an event listener for the "close" event, which is fired when the web socket connection is ended.
Register an event listener for the "message" event, which is fired every time a message is received from the connected party. The message received is deserialized and made available on the "message" property assigned to the event.
Register an event listener for the "error" event, which is fired when the connection has been closed due to an error.
Unregister an event listener for a particular event type. If no listener is provided, all listeners for that event type will be unregistered. If the event type is also omitted, all listeners for the web socket will be unregistered.