config(params)

  • Call: appc.gapi.prototype.config(params)
  • Parameters: params
    params: an object:
    {
        type:       "<transport type ('http' or 'ws')>",
        user:       "<username (in email format)>",
        token:      "<authentication token, returned from a call to login or auth>" 
        gwid:       "<gateway Id, returned from a call to login or auth>"
    }
  • Returns: none -- this a synchronous call and does not use callbacks.

Description:

Configure API parameters.

Default values are automatically set by login.

The default gwid is the first GAPI gateway id returned by login. The gwid may be changed to another valid gateway using config prior to calling open.

Example:

In this example the type is chosen and the gwid set:

    gapi.config({
        'type': 'ws',
        'gwid': "ABCDEF1234567890"
    });

This could be used prior to calling open to select a non-default gateway.

Example:

In this example the user, token and gwid are set:

    gapi.config({
        'user': 'joe@smith.com',
        'token': '123456',
        'gwid': "ABCDEF1234567890"
    });

This could be used prior to calling open to reuse the current authentication token with another gateway. Note that login creates a new authentication token.