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

x/snel/imports/wocket.ts>Transmitter

A Cybernetical framework for svelte applications in deno
Latest
class Transmitter
import { Transmitter } from "https://deno.land/x/snel@v0.7.1/imports/wocket.ts";

The Transmitter class is used as the middleman between the client and server, when sending messages, to connect the 'wires' between them.

Constructors

new
Transmitter(server: Server, options?: ITransmitterOptions)

Construct an object of this class.

Properties

private
ping_interval: number | undefined

See ITransmitterOptions

private
ping_timeout: number | undefined

See ITransmitterOptions

private
reconnect: boolean | undefined

See ITransmitterOptions

private
server: Server

A property to hold the socket server.

Methods

private
ping(clientId: number): void

Pings client at a set interval.

private
startHeartbeat(clientId: number): number

Start a heartbeat for the client in question.

private
timeoutPing(clientId: number): void

Pings client at a timeout. If client does not respond, client connection will be removed.

handlePacket(packet: Packet): Promise<void>

Decodes and validates incoming messages.

Handles connection states, and actions based on those states.

hydrateClient(clientId: number): void

Hydrate the client with properties.