Class: chatHandler

chatHandler(server)

Class containing global server-side chat relay logic

Constructor

new chatHandler(server)

Instantiates a chatHandler object
Parameters:
Name Type Description
server channelManager Parent Server Object
Source:

Methods

(async) addPersonalEmote(socket, data)

Handles incoming client request to add a personal emote
Parameters:
Name Type Description
socket Socket Socket we're receiving the request from
data Object Event payload
Source:

clearChat(user, chan)

Clears chat for a given channel, targets specified user or entire channel if none found/specified.
Parameters:
Name Type Description
user String User chats to clear
chan String Channel to broadcast message within
Source:

defineListeners(socket)

Defines global server-side chat relay event listeners
Parameters:
Name Type Description
socket Socket Requesting Socket
Source:

(async) deletePersonalEmote(socket, data)

Handles incoming client request to delete a personal emote
Parameters:
Name Type Description
socket Socket Socket we're receiving the request from
data Object Event payload
Source:

handleChat(socket, data)

Handles incoming chat messages from client connections
Parameters:
Name Type Description
socket Socket Socket we're receiving the request from
data Object Event payload
Source:

relayChannelAnnouncement(msg, links)

Broadcasts announcement to a given channel
Parameters:
Name Type Description
msg String Message Text Content
links Array Array of URLs/Links to hand to the client-side chat post-processor to inject into the final message.
Source:

relayChat(user, flair, highLevel, msg, type, chan, links)

Creates a new chatObject and relays the resulting message to the given channel
Parameters:
Name Type Default Description
user String Originating user
flair String Flair ID to mark chat with
highLevel Number High Level to mark chat with
msg String Message Text Content
type String chat Message Type, used for client-side chat post-processing.
chan String Channel to broadcast message within
links Array Array of URLs/Links to hand to the client-side chat post-processor to inject into the final message.
Source:

relayChatObject(chan, chat)

Relays an existing chat object to a channel
Parameters:
Name Type Description
chan String Channel to broadcast message within
chat chat Chat Object representing the message to broadcast to the given channel
Source:

relayGlobalChat(user, flair, highLevel, msg, type, links)

Creates a new chatObject and relays the resulting message to the entire server
Parameters:
Name Type Default Description
user String Originating user
flair String Flair ID to mark chat with
highLevel Number High Level to mark chat with
msg String Message Text Content
type String chat Message Type, used for client-side chat post-processing.
links Array Array of URLs/Links to hand to the client-side chat post-processor to inject into the final message.
Source:

relayGlobalChatObject(chat)

Relays an existing chat object to the entire server
Parameters:
Name Type Description
chat chat Chat Object representing the message to broadcast throughout the server
Source:

relayGlobalTokeWhisper(msg, links)

Broadcasts toke whisper to the server
Parameters:
Name Type Description
msg String Message Text Content
links Array Array of URLs/Links to hand to the client-side chat post-processor to inject into the final message.
Source:

relayPrivateChat(socket, user, flair, highLevel, msg, type, chan, links)

Creates a new chatObject and relays the resulting message to the given socket
Parameters:
Name Type Description
socket Socket Socket we're sending a message to (sounds menacing, huh?)
user String Originating user
flair String Flair ID to mark chat with
highLevel Number High Level to mark chat with
msg String Message Text Content
type String Message Type, used for client-side chat post-processing.
chan String Channel to broadcast message within
links Array Array of URLs/Links to hand to the client-side chat post-processor to inject into the final message.
Source:

relayPrivateChatObject(socket, data)

Handles incoming client request to delete a personal emote
Parameters:
Name Type Description
socket Socket Socket we're receiving the request from
data Object Event payload
Source:

relayServerAnnouncement(msg, links)

Broadcasts announcement to the server
Parameters:
Name Type Description
msg String Message Text Content
links Array Array of URLs/Links to hand to the client-side chat post-processor to inject into the final message.
Source:

relayTokeCallout(msg, links)

Broadcasts toke callout to the server
Parameters:
Name Type Description
msg String Message Text Content
links Array Array of URLs/Links to hand to the client-side chat post-processor to inject into the final message.
Source:

relayTokeWhisper(socket, msg, links)

Broadcasts toke callout to the server
Parameters:
Name Type Description
socket Socket Socket we're sending the whisper to
msg String Message Text Content
links Array Array of URLs/Links to hand to the client-side chat post-processor to inject into the final message.
Source:

relayUserChat(socket, msg, type, links)

Relays a chat message from a user to the rest of the channel based on socket
Parameters:
Name Type Description
socket Socket Socket we're receiving the request from
msg String Message Text Content
type String Message Type, used for client-side chat post-processing.
links Array Array of URLs/Links to hand to the client-side chat post-processor to inject into the final message.
Source:

(async) setFlair(socket, data)

Handles incoming client request to change flair
Parameters:
Name Type Description
socket Socket Socket we're receiving the request from
data Object Event payload
Source:

(async) setHighLevel(socket, data)

Handles incoming client request to change high level
Parameters:
Name Type Description
socket Socket Socket we're receiving the request from
data Object Event payload
Source: