How channels work

Technically, a channel is an entry in the junaio backend that registers a specific AREL experience with the channel ID.

Much like a website, the source of this AREL experience is defined by the channel content URL. This URL is supposed to deliver valid AREL XML that will be then parsed by the client application.

Data flow overview

When an client application application opens a channel, the following steps are taken:

 

  1. The client sends an HTTP request to the junaio server to get the channel content for a specific channel ID
  2. The backend looks up the respective channel content URL and send a HTTP request to the channel content URL.
    This request can contain the location of the user, as well as the device type.
  3. The channel server then responds to the request with XML. This can be either a static XML file, or dynamically created XML through PHP (e.g. using the PHP Helper library)
  4. The junaio server forwards this XML to the client, which parses the response.
  5. The client then goes on and downloads all remaining assets like AREL HTML and javascript, 3D models, images, movies, etc. (in case they are not cached yet)

Channel ID

Each channel gets its unique channel ID. When an application like junaio or your metaio Cloud Plugin accesses as channel, it passes the channel ID to the server, which then forwards the request to the channel's content URL.

Content Server URL

The content server URL (formerly 'callback URL') is the HTTP address of where the channel XML is created. Depending on the type of channel, there are some differences: 

Static channels

For AREL channels that deliver static XML, the callback URL will be a simple link to an XML file. E.g.:

http://testchannel.junaio.com/junaio-quickstarts/GLUE_1_HelloGlue/arel.xml

Static XML files are the simplest and fastest channels, as the server just has to provide the file without interpreting any server code.

The channel logic is implemented in javascript, so just because it's called 'static channel' does not mean that there is no logic in the channel.

Dynamic channels

If your channel should return dynamic XML based on the user input (e.g. you want to return POIs based on the user's position), the resulting XML has to be created dynamically.

In the example on the right, you might have a database that contains your objects. Based on the input, your PHP code could perform a database query, returning all POIs close to the user's position. Using the Arel PHP helper, the PHP script then creates AREL XML and returns it.

The junaio server will access your servers content URL via these requests:

pois/search

[YourChannelsContentURL]/pois/search/[?Parameters]

pois/search is usually triggered when a user opens your channel.

It's also possible to trigger pois/search through arel javascript, by calling arel.Scene.triggerServerCall (if sendCameraImage parameter is false)

Example request:

Content URLhttp://testchannel.junaio.com/junaio-quickstarts/LBS_9_FilterTheWorld/

Requesthttp://testchannel.junaio.com/junaio-quickstarts/LBS_9_FilterTheWorld/pois/search/?uid=someUID&l=37.777933,-122.421455,0&p=3000&m=20

 

As you can see from the example above, your content URL gets a couple of parameters that you can use:

Implementation:Callback request from junaio
Method:GET
Parameters:
l:

[latitude:float],[longitude:float],[altitude:float]

Current location of the user.

p:

[perimeter:int]

Perimeter around the users location of the requested information.

m:

[limit:int]

Maximum amount of POIs to be returned to the client. The junaio server will by default process max. 40 POIs per request.

uid:

[usertoken:alnum]

Unique usertoken.

device:

[device:string]

The device with which the channel was accessed. iphone, ipad, android or web.

apilevel:[apilevel: int]
Determines the apilevel of the client accessing your channel. 
Header Parameters:
HTTP_ACCEPT_LANGUAGE:

[language_code:string]

ex. de (German), en (English), jp (japanese), es (Spanish) ...

Returns:
Expects Channel Content return

pois/visualsearch

YourChannelsContentURL]/pois/visualsearch/

By implementing the pois/visualsearch interface in your channel, you can use images sent by the user from the mobile application to your server, to do further server side recognition or other image processing.

pois/search is usually triggered when a user opens your channel.

It's also possible to trigger pois/search through arel javascript, by calling arel.Scene.triggerServerCall (if sendCameraImage parameter is true)

 

Implementation:Callback request from junaio
Method:POST
Parameters:
l:

[latitude:float],[longitude:float],[altitude:float]

Current location of the user.

uid:

[usertoken:alnum]

Unique usertoken.

device:

[device:string]

The device with which the channel was accessed. iphone, ipad, android or web.

apilevel[apilevel: int]
Determines the apilevel of the client accessing your channel. 
File Parameters:
image

[image:file]

The image file taken by the user when clicking the "scan" button within your channel.

Header Parameters:
HTTP_ACCEPT_LANGUAGE:

[language_code:string]

Returns:
Expects Channel Content return

Table of Contents

  • dummy
  • Table of Contents

    • dummy
    • Table of Contents

      • dummy
      • Table of Contents

        • dummy
        • Table of Contents

          • dummy
          • Table of Contents

            • dummy
            • Table of Contents

              • dummy