Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/wocket/src/client.ts>Client

A WebSocket library for Deno
Latest
class Client
import { Client } from "https://deno.land/x/wocket@v1.0.0/src/client.ts";

This class represents a single end-user client. It contains information about their connection ID (when they first connected to the server), their web socket connection, and more.

Constructors

new
Client(id: number, socket: WebSocket)

Construct an object of this class.

Properties

id: number

This client's ID, which is the ID of its socket connection when it connected to the server. For example:

const clientId = conn.rid;
socket: WebSocket

This client's WebSocket instance.

uuid: string

Not used internally, added to allow users to assign uuids to clients if they wanted to, mainly to remove any possible type errors

Methods

send(message:
| string
| ArrayBufferLike
| Blob
| ArrayBufferView
): void