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

x/snel/imports/wocket.ts>Sender

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

The Sender class is responsible for adding messages to the message queue, and then to work through the queue stack which will send the message.

Properties

private
packet_queue: Array<{ packet: Packet; channel: Channel; clientToSendTo?: number; }>

A queue of packets.

private
ready: boolean

Tells Sender when it is ready to work through the packet queue. For instance, whilst sending a packet, ready is false and once the packet is sent, the class is ready to send another packet.

Methods

private
send(): Promise<void>

Encodes messages and sends event to all clients listening to the channel or event except for the sender.

add(
packet: Packet,
channel: Channel,
clientToSendTo?: number,
)

Adds a new message to the message queue to be sent.

hasPackets(): boolean

Does this sender have packets that still need to be sent?