Register
Before using the bus layer, you must send this event to be able to establish a secure communication tunnel between your app and bus.
{
"type": "BUS.REGISTER",
"payload": {
"origin": "String!",
"appName": "String!",
"release": "String!"
}
}
Usage
As for every other bus
event, all the payloads are being validated to make sure that it matches the requirements.
Once the payload is validated, bus
will only intercept the events coming from the origin you specified in the payload and will ignore all the others without warning.
You shall receive a BUS.REGISTER_FULFILLED event with a different payload depending on the situation:
- If the system is not able to restore a valid user session, you should expect receiving the following event:
{
"type": "BUS.REGISTER_FULFILLED"
}
- If the session is retrieved, you shall receive:
{
"type": "BUS.REGISTER_FULFILLED",
"payload": {
"user": User
}
}
Reference
origin
: it's very important parameter, that should match the origin of the window that sent the message at the timepostMessages
was called. it's used to verify the identity of the sender and also used to avoid other malicious site from intercepting the data sent frombus
usingpostMessage
.appName
: it should match your application name, for instance salesforce, hubspot, phone etc ..release
: this is useful for internal debugging purposes. this should correspond to your app release version.