Talkilla/SPA API: Difference between revisions

Jump to navigation Jump to search
Update the initialisation section
(Update the initialisation section)
Line 28: Line 28:
When Talkilla starts within SocialAPI, as part of its initialization, it will start a web worker (https://developer.mozilla.org/en-US/docs/Web/Guide/Performance/Using_web_workers ) for each installed SPA.  
When Talkilla starts within SocialAPI, as part of its initialization, it will start a web worker (https://developer.mozilla.org/en-US/docs/Web/Guide/Performance/Using_web_workers ) for each installed SPA.  


When the SPA has finished loading (including all its dependencies; if any), it sends to Talkilla a message announcing it is ready to receive the user's credentials:
When the SPA is loaded, Talkilla will send a message containing the credentials to connect the SPA to its provider:
 
postMessage({topic: "ready", data: {capabilities: ["call"]}});
 
The capabilities array lists all the features supported by the SPA. "call" means the SPA is able to place calls and receive incoming calls.
Other capabilities (still work in progress) include: "presence", "addressbook", ...
 
Talkilla will reply with a message containing the credentials:
event.data will be:
event.data will be:
  {topic: "credentials", data: {token: auth_string}}
  {topic: "connect", data: <credentials>}
where auth_string is the string added to the callback URL by the service provider's website when redirecting the user to the Talkilla website after successfully authenticating the user.
where `credentials` is an arbitrary object containing the user's credentials for this SPA/Provider.


At this point, the SPA can start connecting to the service provider's servers.
At this point, the SPA can start connecting to the service provider's servers.
Line 44: Line 37:


  postMessage({
  postMessage({
   topic: "logged-in",
   topic: "connected",
   data: {
   data: {
     addresses: [{type: "pstn", value: "+33698234520"},
     addresses: [{type: "pstn", value: "+33698234520"},
4

edits

Navigation menu