High Level Protocol

This document describes the application messaging protocol in terms of the operations a Hub and a client application should support. It does not describe lower level details such as the wire protocol and parameter types. This document is still under discussion and will change.

In the following, I've used [] to denote multiple values, rather than necessarily an array.

The operations/methods a Hub should support

Registration

1 private-id = register*(hub-secret)

2 declareAppMetaData(private-id, metadata[])

3 declareMessages(private-id, mtypes[])

Once an application has located a hub (by means as yet undecided), its first step is to register with it - this needs only be done once per session per application. The application provides the hub with a secret key that is only easily knowable by applications running under the user's uid. This is to make it harder for unauthorized applications to register by (for example) port scanning.

The hub provides the application with a session-unique private-id that is used to authenticate subsequent communications, and is kept secret from other applications to avoid application-spoofing. Each application will also be assigned a public-id that is used to identify it to other applications (see below).

Note that asterisk in the register operation. This denotes that there could be several different register operations, one for each "wire protocol". An application would choose the register operation appropriate to the way it wanted to communicate.

Operation 2) is for the application to tell the hub about itself: a human-readable name, and maybe an icon, description etc.... I see this as being more contentious: we could instead simply use messages between applications to achieve the same thing. The advantage of having it as an operation in the protocol is for those environments that can send messages but can't easily receive them. For instance, I could send a message from the python commandline to Topcat, and all Topcat would have to identify me would be the hub-generated unique id, which isn't very friendly. If I'd also declared some metadata to the hub, then Topcat could interrogate the hub to find out just who senderId=app://1234567-891 is.

Operation 3) is for the application to tell the hub which message types it wishes to receive. The hub won't send it messages it can't understand, and applications can interrogate the hub (using operation 10) to determine the appropriate messages to send. We might need a mechanism to say "send me messages of any type", or "send me messages matching this pattern."

4 unregister(private-id)

When an application closes, it should inform the hub.

Messaging

5 msgId = send(sender-private-id, recipient-public-Id, message)

6 msgId = broadcast(sender-private-id, message)

5) sends a message from sender to recipient using the hub-supplied ids for addressing. The sender's private-id is obtained on registration, while the recipient's public-id is obtained by interrogating the hub (see below). 6) sends the message to everyone (if they've elected to receive that message's mtype). The hub returns a session-unique msgId that can be used in further comms, such as to tie reply messages up with request messages.

we need to elaborate on this msgId idea a bit

These messages are asynchronous in the sense that they return as soon as the hub has received the message. Hubs will disregard messages with unknown or invalid private-ids.

The contents of message are specified on ApplicationsMessagingMsgContent.

Application and hub metadata

7 hub-public-id = getHubId() We can treat the hub itself as just another application that can be messaged. However, you do need to know which application it is, and this operation does the job.

8 public-ids[] = getApplicationIds()

Tell me the hub-assigned public ids of all the registered applications.

9 public-ids[] = getApplicationsUnderstanding(mtype)

Tell me the hub-assigned public ids of the all the registered applications that understand messages with this mtype.

10 mtypes[] = getUnderstoodMessagesForApplication(public-id)

Tell me the mtypes of the messages this application wants to receive.

11 metadata[] = getAppMetaData(public-id)

Return the metadata for that application.

12 public-id = getPublicId(private-id)

An application will use its private-id for all communication with the hub, but it might occasionally need to know its public-id.

The operations a client application should support

13 receive(recipient-publid-id, sender-public-id, msgId, message)

Receive a message from this sender.

Application metadata

In PLASTIC, the hub stores the human-readable name of each application, in addition to its generated id. Additionally other metadata, such as a logo and description is available by using some standard messages. I propose to move all of this to the hub so it is accessible by environments that cannot receive response messages, and tidy it up.

I suggest that the metadata is a struct mapping keys to values that has certain reserved keys:

ivoa.name

ivoa.description

ivoa.ivorn

ivoa.logoURL

The prefix ivoa. would be reserved, but application authors are free to add new data to this struct. This would allow users such as Mike to define (e.g.) iraf.worker=1

to filter the connected applications.


-- JohnTaylor - 10 Apr 2007

Topic revision: r6 - 2007-04-24 - JohnTaylor
 
This site is powered by the TWiki collaboration platformCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback