Changes

Jump to: navigation, search

CloudServices/Presence

1,319 bytes added, 14:43, 22 January 2014
1. Device Channel to Mozilla Presence
The user may connect to the socket using a valid FxA (which will entail a BrowserID Assertion per FxaSSO), and send status updates.
The data must be sent in JSON and is based on a lose simple protocol where they are two mandatory fields:a first request must be made to create a new session. Each subsequent request is a status update. The server or the user can disconnect from the socket at any time and for any reason. In that case the session is lost and a new session must be initiated.
* '''assertion''' : a valid persona assertion* '''type''' : the type of request. so far we have "visibility" and "status" - everything else will be rejected==== Session Request ====
Example of a session request:  {'type': 'connect', 'application_ids': [421, 492, 9592, 391], 'assertion': 'valid persona assertion'} where:* '''assertion''' is a valid persona assertion* '''type''' is the type of request. in that case "connect"* '''application_ids''' is the list of applications IDs presence updates should be sent to. The '''application_ids''' field is used because Mozilla Presence does not retain a list of applications authorized to see updates, this. This data is kept only on the phone. As a result, the device must indicate what application ID'spresence data should be sent to when connecting. This is done in  The server validates the assertion by sending it to a application stanzapersona/fxaccount verifier,and if valid, creates a unique session id and cansends it back to the cient. Example: {'result': true, 'session_id': '61539351-1f02-4b62-a136-205000ece41a'}be sent during In case there's an issue, like an invalid assertion, the server will send back a connection if request with a user is changing what applications can see result flag set to false, an '''errno''' field with an error code (to be documented) - and an error message in the status as well'''reason''' field.
Example:
{'typeresult': 'visibility'false, 'application_idserrno': [42134, 492, 9592, 391], 'assertionreason': 'valid persona Invalid assertion'} 
==== Status Update Request ====
Status Once the session is set, the client can send status updates .
Example:
{'type': 'status',
'assertionsession_id': 'valid persona assertion61539351-1f02-4b62-a136-205000ece41a',
'status': 'online'}
where:* '''session_id''' the session ID* '''type''' is the type of request. in that case "status"* '''status''' the presence status. The status value must be one of "online", "offline", "unavailable".
In case the device wants to send a status update to a specific subset
that call.
Example:  {'type': 'status', 'session_id': '61539351-1f02-4b62-a136-205000ece41a' 'application_ids': [421, 391], 'status': 'offline'} For every status request received, the server sends back an ACK message.
Example:
{'result': 'OK'true}
In case of an error, the server may will send back an extra 'errno' field with an error code (codes to be documented) and an optional 'errorreason' message.
Example:
{'result': 'KO'false, 'errno': 34, 'errorreason': 'Invalid assertionAssertion expired'} The error codes have to be documented, but in case the errno value isa negative value, the session is lost and the client has to recreate a new one.
The user can send as many updates as it wants, but the server can ask it to slow down with a specific error code (codes to be documented)
The server or the user can disconnect from the socket at any time and for any reason.
Confirm
927
edits

Navigation menu