Skip to content

Server's Model

Bahriddin Abdiev edited this page Nov 21, 2017 · 1 revision

Server’s Model module consists of two classes, ServerCanvas and MessageHandler. The server works in a passive mode, in the sense that it will only send messages after receiving a new message.


ServerCanvas

ServerCanvas stores the canvas, the log, the name of the canvas, the name of the manager, and a list of all the users that have joined the whiteboard. All the operations related to the server’s canvas are implemented in this class, as well as user related functionalities such as kicking the user.


MessageHandler

MessageHandler handles every message it receives from the Network module. In fact, there is only one public method which can be called by the Network module in MessageHandler, called handleMessage(). Every time the network module receives a message from any client, it calls handleMessage() to generate a list of messages as responses. For instance, if a client sends a new drawing to the server, the MessageHandler will generate a list of the same drawing messages to be sent to all the clients.

Clone this wiki locally