0.1.0-alpha.1
A simple WebSocket client for Deno
Attributes
Includes Deno configuration
Repository
Current version released
a year ago
Dependencies
std
Versions
WS Client
A simple WebSocket client for Deno, inspired by pogsocket and v-websocket.
Usage
import { ... } from "https://deno.land/x/socket_client@VERSION/mod.ts";
Note Require
--allow-read
and--allow-net
flags.
Example
import { WSClient, OpCode } from "https://deno.land/x/socket_client@VERSION/mod.ts";
const client = new WSClient({
uri: "ws://localhost:80/"
});
client.onmessage = (_, message) => {
if (message.opcode === OpCode.TextFrame) {
console.log(new TextDecoder().decode(message.payload));
}
};
await client.connect();
client.sendMessage("ping");
Links
License
MIT License. See LICENSE