-
Notifications
You must be signed in to change notification settings - Fork 0
ServerRESTAPI
Messages from clients (either iPad or Web) are all sent to the server over HTTP. This page describes the API for those methods.
There are two kinds of resources in the system. Almost all resources modify the internal state of the server (like logging a user in, adding a task, adding a note, etc). This one is special – this resource is how the server sends messages to its connected clients. Unlike a normal HTTP request, when a client connects to /connect/, the server holds that connection open. When the server wants to send a message to that client (for instance, if someone new joined the meeting that client is in) it can look up this connection object and send a message to the client on it and close the connection. It is then the client’s job to process that message and instantly reconnect. This cycle is usually pretty fast – on the order of 50ms in good latency conditions – but there are small windows where a client doesn’t have an open connection. To handle that, User objects accumulate messages that the server wants to send to that client in a queue. When they reconnect, we first check to see if they have any pending messages. If they do, we send those immediately and close the connection. Otherwise, we hold onto the connection until we have something to say to that client.
Because this is essentially a server→client channel, there’s only one argument:
- userUUID – the UUID of the user this connection is for. This is totally fakeable – we will need to change over to cookies at some point to enforce this, otherwise people will be able to connect and pretend to be any user. For now, though, this works.
Adds the specified user to the specified room, and either joins the in-progress meeting in that room or automatically creates a new meeting if the room is empty. Triggers a full dump of the meeting’s history onto the channel so the joining client can catch up on what’s happened.
- userUUID – the user joining the room
- roomUUID – the room being joined
Removes the specified user from the specified room.
- userUUID – the user joining the room
- roomUUID – the room being joined