Loop/Architecture/Rooms: Difference between revisions

Jump to navigation Jump to search
no edit summary
(Created page with "'''''This is still under construction, is missing important details, and may change substantially as scenarios are fleshed out further. Do not implement.''''' Based on early...")
 
No edit summary
Line 15: Line 15:
| Wed Sep 10 09:11:58 CDT 2014 || Adam Roach || Initial version
| Wed Sep 10 09:11:58 CDT 2014 || Adam Roach || Initial version
|}
|}
== Mapping to TokBox Concepts ==
The TokBox toolkit is based on a model of indestructible sessions (identified by a Session ID), which clients join by being issued session tokens, which expire after a predetermined period of time. API-wise, sessions are designed to support an arbitrary number of participants.
The rooms implementation will map each Loop room to a single session, which is created when the room is first created. Once a room is created, this room-to-session binding will remain constant throughout the lifetime of the room.
Each time a user joins a room, he will be issued a new session token to do so. If a user leaves a room and re-joins, he is issued a new token.
== User Identification in a Room ==
[https://tokbox.com/opentok/libraries/server/node/#generatingtokens When the Loop server generates a new token for a user], it optionally includes a "data" field. This field is then communicated to other participants in the room when the corresponding user joins the room: the [https://tokbox.com/opentok/libraries/client/js/reference/ConnectionEvent.html ConnectionEvent] on [https://tokbox.com/opentok/libraries/client/js/reference/Session.html Session] contains a [https://tokbox.com/opentok/libraries/client/js/reference/Connection.html Connection object], which includes a "data" field. This is the same "data" as was provided by the server when the token was created.
The Loop server, when generating a toke for a user in a room, will set the contents of the "data" field to a JSON string, containing the following information:
{
    "displayName": "Alexis",
    "account": "alexis@example.com",
    "id": "2a1787a6-4a73-43b5-ae3e-906ec1e763cb"
}
* '''displayName''' -
* '''account''' -
* '''id''' -
== Room Size Handling ==
== Room Membership and Soft State ==
== Removing Participants from a Room ==
Because user is moderator, can use forceUnpublish and forceUnsubscribe to remove user from room.
== Room Owner Notificaion ==


== Loop Server API Additions ==
== Loop Server API Additions ==
Line 56: Line 87:
* '''expiresAt''' -
* '''expiresAt''' -


''Server implementation note: To avoid certain race conditions, we will want to use the same sessionId for all uses of a room. To ensure this, the Loop server should contact the TokBox servers and retrieve a sessionId for the room at room creation time. This sessionId should be stored persistently with rest of the information associated with the room.''
''Server implementation note: The Loop server should contact the TokBox servers and retrieve a sessionId for the room at room creation time. This sessionId should be stored persistently with rest of the information associated with the room.''


=== PUT /room-url/{token} ===
=== PUT /room-url/{token} ===
Line 84: Line 115:
     "expiresAt": 1405534180
     "expiresAt": 1405534180
  }
  }
* '''expiresAt''' -


=== DELETE /room-url/{token} ===
=== DELETE /room-url/{token} ===
Line 100: Line 133:
  Server-Authorization: <stripped>
  Server-Authorization: <stripped>


'''Client implementation note: client should check room membership and forceUnpublish() all current participants'''
''Client implementation note: client should check room membership and forceUnpublish() all current participants''


=== GET /rooms/{token} ===
=== GET /rooms/{token} ===
Line 125: Line 158:
     "expiresAt": 1405534180,
     "expiresAt": 1405534180,
     "participants": [
     "participants": [
         { "name": "Alexis", "account": "alexis@example.com", "id": "2a1787a6-4a73-43b5-ae3e-906ec1e763cb" },
         { "displayName": "Alexis", "account": "alexis@example.com", "id": "2a1787a6-4a73-43b5-ae3e-906ec1e763cb" },
         { "name": "Adam", "id": "781f012b-f1ea-4ce1-9105-7cfc36fb4ec7" }
         { "displayName": "Adam", "id": "781f012b-f1ea-4ce1-9105-7cfc36fb4ec7" }
       ]
       ]
  }
  }
* '''roomName''' -
* '''roomOwner''' -
* '''maxSize''' -
* '''urlCreationDate''' -
* '''expiresAt''' -
* '''participants''' -
Each participant is formatted with the same fields as described in [[#User Identification in a Room]]


=== POST /rooms/{token} ===
=== POST /rooms/{token} ===
The "POST /rooms/{token}" endpoint is used for a variety of purposes. The JSON object in its body contains an "operation" parameter to indicate which of these purposes the operation is being used for.
The "POST /rooms/{token}" endpoint is used for a variety of purposes. The JSON object in its body contains an "operation" parameter to indicate which of these purposes the operation is being used for.
''explain soft state approach here''


==== Joining a Room ====
==== Joining a Room ====
Line 149: Line 189:
     "clientMaxSize": "2"
     "clientMaxSize": "2"
  }
  }
* '''operation''' -
* '''displayName''' -
* '''clientMaxSize''' -


  HTTP/1.1 200 OK
  HTTP/1.1 200 OK
Line 162: Line 206:
     "expires": "600"
     "expires": "600"
  }
  }
* '''apiKey''' -
* '''sessionId''' -
* '''expires''' -


==== Refreshing Membership in a Room ====
==== Refreshing Membership in a Room ====
Line 174: Line 222:
     "operation": "refresh"
     "operation": "refresh"
  }
  }
* '''operation''' -


  HTTP/1.1 200 OK
  HTTP/1.1 200 OK
Line 184: Line 234:
     "expires": "600"
     "expires": "600"
  }
  }
* '''expires''' -


==== Leaving a Room ====
==== Leaving a Room ====
Line 196: Line 248:
     "operation": "leave"
     "operation": "leave"
  }
  }
* '''operation''' -


  HTTP/1.1 204 No Content
  HTTP/1.1 204 No Content
Line 204: Line 258:
List all rooms associated with account
List all rooms associated with account


  GET /rooms HTTP/1.1
  GET /rooms?version=<version> HTTP/1.1
  Accept: */*
  Accept: */*
  Accept-Encoding: gzip, deflate
  Accept-Encoding: gzip, deflate
  Host: localhost:5000
  Host: localhost:5000
* '''version''' -


  HTTP/1.1 200 OK
  HTTP/1.1 200 OK
Line 242: Line 298:
  ]
  ]


== Removing Participants from a Room ==
* '''roomToken''' -
Because user is moderator, can use forceUnpublish and forceUnsubscribe to remove user from room.
* '''roomName''' -
* '''maxSize''' -
* '''clientMaxSize''' -
* '''currSize''' -
* '''lastUsed''' -
Confirmed users
632

edits

Navigation menu