View on GitHub

Notepal

Jupiter System - Collaborative Editing - Applied to Sticky Notes

Download this project as a .zip file Download this project as a tar.gz file

Because of the central position of the server in this architecture, communications are only done between each client and the server.

Messages come from both side: from the client when it is connecting/fetching the data and when it is emitting an operation ; and from the server when it is broadcasting those operations to every other client. This means that a socket must be kept open constantly between each client and the server. We will thus use the Websocket technology, through the Socket.io library.

We distinguish 3 kind of messages in our system: Connection, Operation and Disconnection.

Connection

This message is automatically send to the server when the client wants to initiate a connection through the Websocket, allowing to create the socket server-side.

In return, the client receives form the server the current version of the shared data and a list of the already-connected users.

Format of the message

Connection Request

Automatically generated by Socket.io

Replies by the server

Disconnection

This message is automatically send to the server when the client disconnects for any reason (network problem, leaving the page, reloading, ...). When receiving this message, the server desallocates all resources for this user.

Format of the message

Automatically generated by Socket.io, and of course no response.

Operation

This message can be sent by the client to the server or by the server to the client.

An operation is generated by the client's application when a local operation is done.

Format of the message

Join / Leave

When the server notices a connection or disconnection of one of the client, it sends a notification to the other clients so they can update their list of connected clients/users.

Format of the message