A match making engine that routes a User's chat and audio request to the appropriate Agent. Built using Rainbow API and NodeJS.
Note: branch v2.1 is the current heroku deployment.
You may test it yourself by going to this website: https://match-made-on-rainbow.herokuapp.com/. You MUST log in as the 3 Rainbow Agent sandbox accounts as well! Otherwise, there won't be anyone (likely) to which your User will be routed to.
The following are the 3 Rainbow Agent account details:
Username | Password | Skill tags |
---|---|---|
testa@gmail.com | 1234Qwer! | Abdomen |
testb@gmail.com | 1234Qwer! | Back |
testgp@gmail.com | 1234Qwer! | General Enquiry |
Simply login as Rainbow Agents using the details stated in the table above. Visit this website to login as Rainbow Agents: https://web-sandbox.openrainbow.com/app/1.69.3/index.html#/login.
git clone master
branch, in the cloned folder, simply call npm run test
.
This will simulatenously run the junit white box test, blackbox test and system tests.
The report will be printed out in the console, once each tests are completed.
The application follows a seven-step process to connect a User to an appropriate Agent
- The User arrives in the web page, specifies his
tag
and requests to be connected to an Agent. - The match-made-on-rainbow server receives this request and in turn requests rainbow server for an
Anonymous Guest Account
on behalf of User. - Rainbow server creates an
Anonymous Guest Account
for the User and returns alogin_token
. - match-made-on-rainbow server queries the database for currently available User (if necessary) before performs the algorithm on the
tag
and the list of of Agents to find a match. - When match-made-on-rainbow server has found a matching
agent_id
, it sends both theagent_id
and thelogin_token
back to the User's browser. - User receives the
login_token
and theagent_id
which indicate which Agent the User should contact. - User's browser logins as an
Anonymous Guest
usinglogin_token
and creates aConversation
with the designated Agent using Rainbow API
The following image summarizes the seven-step process:
The Routing Algorithm has the following characteristics:
- The algorithm attempts to match a user specifying a certain
tag
with an online Agent who has thattag
in his/herskill_tags
. If there is not a single online Agent that has the specifiedtag
, the User will be notified. - When a match is found, the user will be put in a
Queue
. The Agent will only handle the first User in the queue. i.e. index 0 of theQueue
. - When matching, the algorithm will attempt to put the User in the shortest
Queue
possible. Please see the following diagram for clarity (Note: i denotes the order in which the Users requested to be matched!):
- When a User disconnects, the User is dequeued from the
Queue
. If after dequeueing the Agent'sQueue
is empty, the Agent will steal the second User (index 1) from the longestQueue
. This is an attempt to distribute the load of an Agent.
- When a User is NOT being served (i.e. index > 0), instead of returning the
agent_id
, the algorithm will returnWAIT
signal instead. Users will only receiveagent_id
when they're on the top of theQueue
(index 0)!