The following is a RAW message routing scheme for the new Web Socket Server / Chat Server:
Redis Channels
When an object is pushed to the following Redis queues, it is first picked up by the WSS Broker, and then translated to a Message Type that's further delivered by the WSS Monitor.
The Broker loops through all the Redis queues, or "channels" in one loop before taking a 300ms break.
Note that unless a message is denoted as "as-is", a recomputed version is sent to the web socket client.
actions -> msg.2 (without the "userid" field, or with "userid":0)
{type:update, sid:$wssid, rectype:$rectype, recid:$recid, gsid:$gsid, extra: $extra}
actions -> msg.4 (with a non-zero "userid" field)
{type:update, sid:$wssid, rectype:$rectype, recid:$recid, gsid:$gsid, userid:$userid, extra: $extra}
allactions -> msg.3
{type:update, rectype:$rectype, extra: $extra}
chatbroadcasts -> msg.6
{*as-is*}
chatbroadcasts -> msg.6 (event=agentchanged)
no message, triggers announce_agents
chatalerts -> msg.7 (target=client)
{type:message, maxmsgid:$maxmsgid}
chatalerts -> msg.7 (target=client, alerttype=setagent)
{*as-is*}
chatalerts -> msg.2 (target=agent, without agentid)
{*as-is*}
chatalerts -> msg.4 (target=agent, with agentid)
{type:chat, chatid:$chatid, maxmsgid:$maxmsgid, fromagentid: $senderid}
wssadmin -> msg.9 (cmd="conn")
wssadmin -> msg.9 (cmd="userconn",userid=#)
Monitor Message Types
The WSS Monitor routine processes both internal messages and the messages from the Broker. Broker messages (msg) are divided into subtypes.
- reg (when a client connects)
reg.cc
reg.gs
- dereg (when a client disconnects)
dereg.cc
dereg.gs
- msg (Broker-forwarded message)
msg.0 - single device/SID
msg.1 - all devices (unused)
msg.2 - all GS users within a GS
msg.3 - all GS users
msg.4 - specific GS user
msg.5 - all chat clients (unused)
msg.6 - all chat clients within a GS
msg.7 - specific chat client
msg.8 - agent change broadcast
msg.9 - internal diagnostics
- knocker (20-sec keep-alive)
Authentication Types
Internal (Gyroscope) users and chat clients are authenticated differently.
- WSS***-###-###=
- GSC###-***-###=
Chat Session Manager Subtypes:
- guest sessions
- portal
- partially verified
- fully verified