Changes

Jump to: navigation, search

Loop/Architecture/Rooms

3,104 bytes added, 22:25, 25 February 2015
Added room state update
* '''action''' - For leaving a room, this will be "leave".
* '''sessionToken''' - The session token received when joining the room. Used to identify the session to be left as well as to authorize the user to perform the leave.
 
HTTP/1.1 204 No Content
Connection: keep-alive
Server-Authorization: <stripped>
 
==== Updating Session State ====
In order to track room state for metric purposes, the client will also send a POST message to the "/rooms/{token}" endpoint whenever a state change occurs, according to the following state machine:
 
[[File:loop-room-state.png|center|Room Session State Diagram]]
 
In order to run this state machine, the client must (in addition to the current state) keep track of three counters:
# Total connection count
#* Increased when event "Session.connectionCreated" occurs
#* Decreased when event "Session.connectionDestroyed" occurs
# Count of streams currently being received
#* Increased when event "Session.streamCreated" occurs
#* Decreased when event "Session.StreamDestroyed" occurs
# Count of streams currently being sent
#* Increased when event "Publisher.streamCreated" occurs
#* Decreased when event "Publisher.StreamDestroyed" occurs
 
 
* For a desktop client user, the "Authorization" header field is populated with the HAWK token (using a scheme of "Hawk"), just like it is for other requests.
* For the standalone client, the "Authorization" header field is encoded using [http://tools.ietf.org/html/rfc1945#section-11.1 Basic authentication]. The user ID portion is the sessionToken provided to the user when they joined the room, and the password is blank.
 
POST /rooms/QzBbvGmIZWU HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Content-Type: application/json; charset=utf-8
Authorization: <stripped>
Host: localhost:5000
{
"action": "status",
"event": "Session.connectionCreated",
"state": "sendrecv",
"sessions": 2,
"sendStreams": 1,
"recvStreams": 1
}
 
* '''action''' - For updating session state, this will be "status".
* '''event''' - The event that cause the state to be updated. These are currently based on the TokBox events. Possible values include:
** ''Session.connectionCreated''
** ''Session.connectionDestroyed''
** ''Session.streamCreated''
** ''Session.streamDestroyed''
** ''Publisher.streamCreated''
** ''Publisher.streamDestroyed''
* '''state''' - From the state diagram above. Will be one of:
** ''init'' - Initial and terminal state
** ''waiting'' - Client is in room, is waiting for another user to show up
** ''starting'' - Other user has joined, and media is being established
** ''sending'' - Outbound media streams are set up, but inbound are not
** ''receiving'' - Inbound media streams are set up, but outbound are not
** ''sendrecv'' - Client is sending and receiving media: the session is set up
** ''cleanup'' - No streams are being sent or received, and the session connection should be torn down momentarily
* '''connections''' - Number of ongoing connections (learned by counting Session.connectionCreated and Session.connectionDestroyed)
* '''sendStreams''' - Number of streams being sent (learned by counting Publisher.streamCreated and Publisher.streamDestroyed)
* '''recvStreams''' - Number of streams being received (learned by counting Session.streamCreated and Session.streamDestroyed)
HTTP/1.1 204 No Content
Confirm
632
edits

Navigation menu