import { EventEmitter } from "https://deno.land/x/snel@v0.7.1/imports/wocket.ts";
The EventEmitter class is responsible for the logic of sending and receiving messages. To do this, it aggregates information on clients, such as tracking how many clients are connected and what channels are open.
Properties
A list of key value pairs describing all created channels, where the key is the channel name, and the value represents the channel object.
A list of key value pairs describing all clients connected, where the key is the client id, and the value represents the client object.
Methods
Add a packet to the queue so that the message contained in the packet can be sent to the client(s).
Adds a new client to a channel. Once the client is added, the client will be able to receive messages sent to the channel.
Broadcasts a message to all receivers of a channel. pkgOrMessage does not contain "from" key.
Close a channel.
Adds a new client.
Get a channel by the channel name
Get all of the channels.
Get all clients.
Create and open a channel, and create a listener for events on that channel
Removes an existing client from server and any channels that the client subscribed to.
Removes a client from a channel.
Send a message to a channel, excluding the sender.