Show:

F2.Rpc Class

Handles socket communication between the container and secure apps

Defined in: sdk\src\rpc.js:1

Methods

Name Description
_createAppToContainerSocket ( ) private

Creates a socket connection from the app to the container using easyXDM.

_createContainerToAppSocket (
  • appConfig
  • appManifest
)
private

Creates a socket connection from the container to the app using easyXDM.

_createRpcCallback (
  • instanceId
  • callbackId
)
private
_onMessage (
  • appConfig
  • message
  • origin
)
private

Handles messages that come across the sockets

_registerCallback (
  • callback
)
private

Registers a callback function

broadcast (
  • messageType
  • params
)

Broadcast an RPC function to all sockets

call (
  • instanceId
  • messageType
  • functionName
  • params
)

Calls a remote function

init (
  • [secureAppPagePath]
)

Init function which tells F2.Rpc whether it is running at the container- level or the app-level. This method is generally called by F2.init

isRemote (
  • instanceId
)

Determines whether the Instance ID is considered to be 'remote'. This is determined by checking if 1) the app has an open socket and 2) whether F2.Rpc is running inside of an iframe

register (
  • [appConfig]
  • [appManifest]
)

Creates a container-to-app or app-to-container socket for communication

Methods

_createAppToContainerSocket ( ) private

Defined in sdk\src\rpc.js:15

Creates a socket connection from the app to the container using easyXDM.


_createContainerToAppSocket (
  • appConfig
  • appManifest
) private

Defined in sdk\src\rpc.js:69

Creates a socket connection from the container to the app using easyXDM.

Parameters:

  • appConfig AppConfig

    The F2.AppConfig object

  • appManifest F2.AppManifest

    The F2.AppManifest object


_createRpcCallback (
  • instanceId
  • callbackId
) private

Defined in sdk\src\rpc.js:117

Parameters:

  • instanceId String

    The app's Instance ID

  • callbackId Function

    The callback ID

Returns:

Function:

A function to make the RPC call


_onMessage (
  • appConfig
  • message
  • origin
) private

Defined in sdk\src\rpc.js:135

Handles messages that come across the sockets

Parameters:

  • appConfig F2.AppConfig

    The F2.AppConfig object

  • message String

    The socket message

  • origin String

    The originator


_registerCallback (
  • callback
) private

Defined in sdk\src\rpc.js:216

Registers a callback function

Parameters:

  • callback Function

    The callback function

Returns:

String:

The callback ID


broadcast (
  • messageType
  • params
)

Defined in sdk\src\rpc.js:230

Broadcast an RPC function to all sockets

Parameters:

  • messageType String

    The message type

  • params Array

    The parameters to broadcast


call (
  • instanceId
  • messageType
  • functionName
  • params
)

Defined in sdk\src\rpc.js:243

Calls a remote function

Parameters:

  • instanceId String

    The app's Instance ID

  • messageType String

    The message type

  • functionName String

    The name of the remote function

  • params Array

    An array of parameters to pass to the remote function. Any functions found within the params will be treated as a callback function.


init (
  • [secureAppPagePath]
)

Defined in sdk\src\rpc.js:273

Init function which tells F2.Rpc whether it is running at the container- level or the app-level. This method is generally called by F2.init

Parameters:


isRemote (
  • instanceId
)

Defined in sdk\src\rpc.js:289

Determines whether the Instance ID is considered to be 'remote'. This is determined by checking if 1) the app has an open socket and 2) whether F2.Rpc is running inside of an iframe

Parameters:

  • instanceId String

    The Instance ID

Returns:

Bool:

True if there is an open socket


register (
  • [appConfig]
  • [appManifest]
)

Defined in sdk\src\rpc.js:308

Creates a container-to-app or app-to-container socket for communication

Parameters: