Studio:AutoScript Messages: Difference between revisions
No edit summary |
|||
Line 20: | Line 20: | ||
=== Messaging Types === | === Messaging Types === | ||
==== Broadcast | ==== Broadcast Messaging ==== | ||
Broadcast messaging is the simplest form of asynchronous messaging. A message user subscribes to a message. The message owner broadcasts messages. The messages are placed on the message user's event queue. When the message user script is finished listening for messages, the script calls Unsubscribe to cease receiving messages. | |||
==== One-Way Command Messages ==== | ==== One-Way Command Messages ==== | ||
One-Way Command messaging may be either synchronous or asynchronous. This messaging means that the message user sent a message command payload to the message owner. The message user did not receive a message response payload from the message owner. | |||
==== One-Way Response Messages ==== | ==== One-Way Response Messages ==== | ||
One-Way Response messaging may be either synchronous or asynchronous. This messaging means that | |||
==== Two-Way Command/Response Messages ==== | ==== Two-Way Command/Response Messages ==== | ||
Line 28: | Line 31: | ||
== Broadcast | == Broadcast Messages == | ||
Broadcast messaging is used to have a message owner broadcast messages. A message user will subscribe to a message for a time. The message user will receive messages until the message user's script exits or until it unsubscribes from the message. The exact process for how this is achieved is as follows: | Broadcast messaging is used to have a message owner broadcast messages. A message user will subscribe to a message for a time. The message user will receive messages until the message user's script exits or until it unsubscribes from the message. The exact process for how this is achieved is as follows: | ||
Revision as of 22:37, 9 July 2008
STRIDE offers many types of messaging as well as many options on messaging. To ease your understanding, this section describes overall concepts and then describes the precise functionality that STRIDE provides.
Messaging Concepts
Origin and Directioning
STRIDE has the concept of a message owner and a message user. In general STRIDE usage, the Owner and User imply target and host, but for messaging this meaning is transparent.
Message User
A message user may be any script that is not registered as the owner.
Message Owner
The message owner is a script that has successfully registered itself as the owner of the message (by calling the Register method). A message may only have one registered owner.
Message Override Owner
The message override owner of a message is the script that successfully registered as the override owner (by calling the RegisterOverride method). An override owner is used to bypass the registered owner. If a message has an override owner registered, messaging is processed with the override owner and not the registered owner. This allows the ability to code scripting with the registered owner, but to bypass the registered owner in the event that registered owner does not process correctly.
Synchronous / Asynchronous Messaging
Messages that are sent between a message owner and a message user may asynchronous or synchronous.
Asynchronous Messaging
An asynchronous message is also known as a "non-blocking" message. A message transfers between message owner and message user. If the message user is initiating a message, the message is sent to the message owner and the message user continues processing. If the message owner is sending a response message the message is sent to the message user and the message owner continues processing. In either case an asynchronous message enqueues an event to the receiver's script queue and continues processing. The initiator was not blocked from continuing processing.
Synchronous Messaging
A synchronous message is also known as a "blocking" message. A message transfers between message owner and message user. If the message user is initiating the message, the message is sent to the message owner and the message user waits until it receives a response. If the message owner is initiating the message, it too is blocked until it receives a response from the message user.
Messaging Types
Broadcast Messaging
Broadcast messaging is the simplest form of asynchronous messaging. A message user subscribes to a message. The message owner broadcasts messages. The messages are placed on the message user's event queue. When the message user script is finished listening for messages, the script calls Unsubscribe to cease receiving messages.
One-Way Command Messages
One-Way Command messaging may be either synchronous or asynchronous. This messaging means that the message user sent a message command payload to the message owner. The message user did not receive a message response payload from the message owner.
One-Way Response Messages
One-Way Response messaging may be either synchronous or asynchronous. This messaging means that
Two-Way Command/Response Messages
Bypass Override
Broadcast Messages
Broadcast messaging is used to have a message owner broadcast messages. A message user will subscribe to a message for a time. The message user will receive messages until the message user's script exits or until it unsubscribes from the message. The exact process for how this is achieved is as follows:
1. A Message User calls Subscribe() to register that it is interested in receiving message events from a given message.
2. When the Message Owner calls Broadcast(), a message event is sent to all Subscribers of the message. The message event received by the Message User is enqueued to its script's event queue. The Message User may then evaluate the messages it has received by making calls to WaitForEvent().
3. When a Message User no longer wishes to receive message events from a given message, it will call Unsubscribe() to unregister its interest in receiving events.
For a broadcast message (a message whose ascript.Messages.Item().Type is "BroadcastMessage"):
- Its owner (ascript.Messages.Item().Owner) will have a Broadcast method.
- Its user object (ascript.Messages.Item().User) will have a Subscribe method and an Unsubscribe method.
- These are the only methods available for this message type. Thus other message methods (e.g. Register/Unregister) will not be available.
Command/Response Messaging
The other form of messaging provided by STRIDE involves direct messaging between a message owner and message user. There are three types of direct messaging between a message owner and message user and they depend upon what information is being passed in which direction.
Message Type |
Meaning |
One-Way Command Messaging | The message user will only send a command payload to the message owner. The message user will not receive any information back from the message owner. |
One-Way Response Messaging | The message user will only receive a response payload from the message owner. The message owner will not receive any information from the message user. |
Two-Way Command/Response Messaging | The message user will send a command payload from the message owner AND it will receive a response payload as part of the messaging. |