Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/sockets/src/client.ts>Client

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

The Client class represents a single end-user client. It contains information about their id, their web socket connection, and many more.

Constructors

new
Client(id: number, socket: WebSocket)

Construct an object of this class.

Properties

heartbeat_id: number | null

The heartbeat_id is the same as the id. It is used to 'poll' the client, to check if the connection is alive.

id: number

The clients id, which is the id of the socket connection sent across.

const clientId = conn.rid;
listening_to: string[]

A list of channels the client is listening to.

pong_received: boolean

How we know that the client connection is ready for a message.

socket: WebSocket

The web socket connection for the client.