---
# System prepended metadata

title: Collaboration whiteboard with Excalidraw

---

Aspects
* Saving policy
    * manual saving for now
    * optional: display a timer to show when it was last saved
    * note: likely not desirable that there is an automatic saving mode on clients triggering server side saves as this could lead to n client all triggering n update. Especially a risk if one client is partially offline for a bit.
* Presencing
    * Potential issue with users remaining visible
        * optional: have this cleared out / on a heartbeat so users go away after a time if no activity
* Access
    * Create new privilege, WHITEBOARD_RT_USAGE, which is only allocated to beta testers
    * Client to check for this privilege when:
        *  Choice to create a callout to people with that privilege
        *  Showing the callout content i.e. to not show the whiteboard contents inside a callout
    *  Authorize if the person is allowed to access the whiteboard (web socket room, not a matrix room), on connection
*  Routing
    *  Support for the routes to be added to all environments
*  Multi-server mode
    *  Investigate if we can use rabbitmq to send the whiteboard events between the servers
        *  Fan out i.e. broadcast 
        *  Temporary way of doing it without dealing with state

Staging:
* Working on develop environment
    * - [x] Server database relations fixed
    * - [x] Routing
    * - [x] Preview of image is saved when the whiteboard is saved
    * Security / access
        - [X] server privilege + usage of beta tester credential
        - [x] client to check for the privilege
        - [x] server to also check for the privilege on the room
    * Functionality to develop branch, with caveat re code quality
    * 
* Working on acceptance
    * Multi-server mode: Investigate doing the event fan-out to allow working on acceptance
* Later
    * Images uploaded within the whiteboard are propagated
    * Showing a time since last save
    * User presencing is removing people



## **Routing example**: 
server 1 with client 1 + client 2
server 2 with client 3 + client 4

event on server 1 is to update client 3 + 4 via server 2. Server 1 will need to tell server 2 what to do.

## Pros'+ cons with moving quickly to develop
Pros
* Able to test out the functionality ourselves in a real setup next week at offsite
* Surface up other issues / considerations quickly
* 

Cons
* Risk to production setup
    * Deployment: making a new release
    * Functionality: Mitigated by having separate logic paths for both server + client, and protect via a privilege
    * Performance: mitigated by having save done manually; to be still further checked
* Pause moving other functionality to develop
    * some PRs will be delayed


## Roadmap
Items to be addressed
* Automatic saving of the whiteboard 
* Conflict resolution via y.js protocol
* Preview image of whiteboard: do we still want this?
* Usability: notification to users when they are not allowed to access a whiteboard
* Access v2: who can do what on the whiteboard rt?
    * Using the read / update privileges directly on the entity, and controlling with flags


## Original requirements

This solution will be using the [excalidraw-room](https://github.com/excalidraw/excalidraw-room) and [excalidraw-app](https://github.com/excalidraw/excalidraw/tree/master/src/excalidraw-app) both by Excalidraw.

## Requirements and setup
- running on the cloud - sandbox
- single instanced
- users are authenticated
- whiteboard is authorizable
- whiteboard does not have a lifecycle
- users are able to see each others mouse movements and actions
- the connection is not encrypted
- the whiteboard is saved
- the whiteboard is loaded
- the user is forced into collaboration mode from the start to the end
- the client is requesting a room with the ID of the whiteboard

### Notes
- no hard requirement on how many people can handle - we have to see how it behaves


## Knowns
- the client is doing the merge
- the client is loading the whiteboard
- the client is saving the whiteboard
- the logic for encryption needs to be removed
- all the UI elements like dialogs and popups need to be removed


## Stories
- [ ] strip elements and encryption; pass whiteboard id into the connection request
- [ ] API extention for creating a whiteboard without a lifecycle; and the logic related to lifecycles bypassed
- [ ] save and load on the client
- [x] excalidraw-room integration into alkemio-server
- [x] authorizable connection
- [ ] authorizable whiteboard on connection