CloudServices/Loop/Server

From MozillaWiki
Jump to: navigation, search
Warning

Firefox Hello (aka Loop) is being shutdown from Firefox 49.
These pages serve as an archive and reference.

Warning


Last updated: 2016/10/11

Overview

The loop project aims to provide a WebRTC application firefox users can use from within Firefox. The server part handles registration of the clients, generation of temporary links and communication with the WebRTC infrastructure provider.

Definitions

  • Simple Push URL: an URL the server can ping in order to wake up the client.
  • FxA assertion: a Firefox Account assertion (read token) containing a way to identify the user on the server
  • Provider tokens: In order to initiate a call between two parties, the provider issues tokens, session ids and client need to have an API key.

APIs

A "*" means this URI requires authentication (Ideally you should pass a valid BrowserID assertion, current implementation does that with a session cookie).

POST /registration

  • Content-Type: 'application/json'
  • Body: simple_push_url
  • Notes: Associates a Simple Push Endpoint (URL) with the authenticated user.

POST /call-url Create the call url a callee can click on. (Requires "remote_id" and "valid_duration" parameters).


GET /calls/{token} Get the app (that's the url in question, which displays an app) (No parameter required.)


POST /calls/{token} Add an incoming call (does a simple push notif and gets room tokens), return participant tokens. (No parameter required.)


GET /calls/

List incoming calls for the authenticated user. (No parameter required.)

User Flow

Let's say Bob wants to be called by Alice. The workflow is as follows:

 1. Bob's client registers with SimplePush, he gets a simple push url back and listens to the WebSocket connection;
 2. Bob's client registers with the loop server
 3. Bob asks the server to generate a call url for him;
 4. Bob gives this URL to Alice;
 5. Alice clicks on the link, server validates the URL and displays a WebApp with a message "do you want to call Bob"?
 6. Alice decides to call Bob, server validates the URL
 7. Server gets provider tokens; Server stores the callee token and session id in database;
 8. Server pings the Simple Push Server to wake up Bob's client;
 9. Server returns caller token, session id and API Key to Alice's client
 10. Bob client wakes up, go on the server to look at the list of incoming calls;
 11. Server returns the list of calls (containing provider information) to Bob's client.
 12. Connection can be done between Alice and Bob!

Loop-server-flow.png