Skip to main content
Module

x/wocket/mod.ts>Client

A WebSocket library for Deno
Latest
class Client
import { Client } from "https://deno.land/x/wocket@v1.0.0/mod.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