This repository has been archived by the owner on May 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 50
Services Adapter to Core Protocol
Thomas O'Connor edited this page Mar 6, 2018
·
2 revisions
{
action: string,
messageId: number, // automatically set by adapter
payload: any // generally an object with options/parameters (undefined if not mentioned in calls below)
}
On the ack from core, return channel for the service to send service messages (see javascript-adapter
)
{
action: 'register-service',
...
}
On the ack from core, return channel for the client to send service messages (see javascript-adapter
)
{
action: 'send-service-message',
payload: {
connectAction: true,
wait?: bool, // options.wait (optional - default to true in adapter if undefined)
uuid: string, // options.uuid (uuid of service - mandatory)
payload?: any // options.payload
}
...
}
Call from client/service to be handled by service/client after connection: fin.desktop.Service.dispatch(topic: string, payload: any, ack?: cb, nack?: cb)
{
action: 'send-service-message',
payload: {
action: string, // topic argument
uuid: string, // uuid of client or service
name: string, // name of client (necessary to send service msg to client)
payload: object // payload argument
}
...
}
{
action: 'process-service-action',
correlationId: number,
payload: {
ackToSender, // object to send back to core to ack to sender (see below)
action: string, // action dispatched by the sender (topic argument in dispatch)
serviceIdentity : Identity, // {uuid: string} - always service Identity no matter the sender
payload, // sender defined payload / arguments for action function
senderIdentity: Identity // {uuid: string, name: string}
}
}
This shape is sent in ackToSender
object in the incoming process-service-action
message (inside the payload above).
{
action: 'service-ack',
correlationId: number,
payload: {
correlationId: number, // provided by core - used to store & retrieve ack from map
destinationToken: identity, // provided by core - identity of original sender
// If it is a connection request, uuid/name of service placed on payload in ackToSender automatically
payload: {
uuid?: string,
name?: string,
result: any // adapter to add any information to ack back to original sender should be put here
},
success: true // change to false to nack
reason?: string // add a reason string here for nack (not passed in original ackToSender)
}