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

x/snel/imports/wocket.ts>Channel

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

Channel represents channels, also known as "rooms". This class describes open channels, and is used to place clients into

Constructors

new
Channel(name: string)

Construct an object of this class.

Properties

callbacks: Array<((packet: Packet) => void)>

The callbacks for listening

function handleChannel1 (...) { ... }
socketServer.on("channel 1", handleChannel1)

handleChannel1 is now registered as a callback.

listeners: Map<number, WebSocket>

Acts as the list of clients connected to the channel. A listener would contain the clients socket id and and the socket connection sent across

new Channel("channel 1").listeners.set(
  2, // clients socket id
  incomingSocketConnection
})
name: string

The name of the channel to create

new Channel("channel 1");