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

x/sockets/src/sender.ts>Sender

A WebSocket library for Deno.
Latest
class Sender
import { Sender } from "https://deno.land/x/sockets@v0.5.0/src/sender.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; }>

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()

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

add(packet: Packet, channel: Channel)

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

hasPackets(): boolean

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