Kentico CMS 7.0 Developer's Guide



Previous topic Next topic Mail us feedback on this topic!  


Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

This topic provides insight into the system of organizing users in the Chat module. It describes how chat users are stored in the database, the difference between anonymous and registered users and the two types of on-line state.


Chat users are an entity separate from CMS users. They are stored in a dedicated database table as a combination of their nickname and a foreign key binding them to CMS users. The binding, however, is optional - absence of the binding makes the user anonymous.


User types


There are two types of chat users - anonymous and registered. Anonymous users are site visitors, who either don't posses a user account on a site, or they do have an account but are not logged in. To enter the chat, users only need to choose a nickname. Registration is not necessary.


If a registered user is logged in, the nickname they choose when entering the chat is tied to their account. As a result, the nickname is reserved for that user.


On-line users


The on-line state of chat users is monitored on two levels - site level and room level. A user who enters the chat starts pinging the server on a regular basis, thus keeping the server aware that they are on-line. When the user goes off-line (i. e. stops pinging the server), their on-line state is changed, rather than the user record being deleted altogether.


When the user enters a room, the client side of the application includes the information in the packets sent to the server, thus notifying the server that they are on-line in a certain chat room. When a user with elevated permissions leaves the room, they are not removed from the room, only their on-line state changes. Users without permissions are removed from rooms immediately after leaving them or leaving the chat. More information about room permissions can be found in the Permissions topic.