Plugin Messages

A plugin can send messages to the Open Client, or to other plugins using the OpenAjax Hub that is shipped with Open Client.

Sending Messages

To send a message, the widget uses the OpenAjax Hub Publish function.

Publish Function

 

 

Purpose

Publishes a message.

Parameters

name is the name of the message.

message is a message object. The contents depend on the message type.

Remarks

Return value:

This function has no return value.     

Example

OpenAjax.hub.publish("proiv.message", {});

The name property identifies the message type. Refer to the section Plugin Object Definition for more details for the message types that are available to the plugin.

Receiving Messages

To receive messages, the widget uses the OpenAjax Hub Subscribe function.

Subscribe Function

 

 

Purpose

Subscribe (or listen) for messages with the specified name.

Parameters

name is the name of the message.

Callback is the Callback function that accepts the message.

scope is an optional scope object used for the Callback function.

subscriberData is optional subscriber data.

filter is an optional Filter function called before the Callback function.

Remarks

Return value:

An object that uniquely identifies the subscription.

Example

var subscribeHandle = OpenAjax.hub.subscribe("proiv.message", msgFunc, this, {}, filterFunc);

The OpenAjax Hub Unsubscribe function allows the widget to stop receiving messages.

Unsubscribe Function

 

 

Purpose

Unsubscribe (or stop listening) for messages.

Parameters

subscriptionHandle – the unique identifier returned by the subscription.

Remarks

Return value:

This function has no return value

Example

OpenAjax.hub.unsubscribe(subscribeHandle);

The Callback function is given a scope (the ‘this’ object) of the defined scope object or the window object if the scope parameter is not defined. The Callback function parameters are name, message and subscriberData (this is null if not defined). The Filter function is called in the same way as the Callback function.

Open Client Messages

Open Client subscribes to the following OpenAjax messages so that a plugin can pass information or requests to the Open Client.

proiv.message.disconnect

OpenAjax.hub.publish("proiv.message.disconnect", {widgetID:"proiv_disconnect"});

This message terminates the current PROIV session.

Comment on this topic

Topic ID: 800071