Studio:AutoScript Messages: Difference between revisions

From STRIDE Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(28 intermediate revisions by 4 users not shown)
Line 8: Line 8:


=== Message User ===
=== Message User ===
A [[ascript#ascript.Messages.Item.User|Message User]] may be any script that is not registered as the message owner or message override owner. The [[ascript#ascript.Messages.Item.User|Message User]] may be access via the message as [[ascript#ascript.Messages.Item.User|ascript.Messages.Item.User]].
A [[AutoScript#ascript.Messages.Item.User|Message User]] may be any script that is not registered as the message owner or message override owner. The [[AutoScript#ascript.Messages.Item.User|Message User]] may be access via the message as [[AutoScript#ascript.Messages.Item.User|ascript.Messages.Item.User]].
<br>
<br>


=== Message Owner ===
=== Message Owner ===
The [[ascript#ascript.Messages.Item.Owner|Message Owner]] is the script that has successfully registered itself as the owner of the message (by calling the Register method). A message will only have one registered owner. Calls to register a second owner will result in an exception will be thrown. Ownership can be surrendered by calling the Unregister method (or by exiting the script that registered ownership). The [[ascript#ascript.Messages.Item.Owner|Message Owner]] may be accessed via [[ascript#ascript.Messages.Item.Owner|ascript.Messages.Item.Owner]].
The [[AutoScript#ascript.Messages.Item.Owner|Message Owner]] is the script that has successfully registered itself as the owner of the message (by calling the Register method). A message will only have one registered owner. Calls to register a second owner will result in an exception will be thrown. Ownership can be surrendered by calling the Unregister method (or by exiting the script that registered ownership). The [[AutoScript#ascript.Messages.Item.Owner|Message Owner]] may be accessed via [[AutoScript#ascript.Messages.Item.Owner|ascript.Messages.Item.Owner]].
<br>
<br>


Line 20: Line 20:


== Message Payloads ==
== Message Payloads ==
Payloads are [[Dynamic Objects|Dynamic Objects]] containing data related to a message. A One-Way Command message may have a Command Payload. A One-Way Response message may have a Response Payload. A Two-Way Message may have both a Command Payload and a Response Payload. The word 'may' is used here because these are the legal conditions of what payloads may exist. For a Command Payload to exist, the captured message must take one or more parameters. For a Response Payload to exist, the captured message must be defined with a response payload.
Payloads are [[AutoScript_Dynamic_Objects|Dynamic Objects]] containing data related to a message. A One-Way Command message may have a Command Payload. A One-Way Response message may have a Response Payload. A Two-Way Message may have both a Command Payload and a Response Payload. The word 'may' is used here because these are the legal conditions of what payloads may exist. For a Command Payload to exist, the captured message must take one or more parameters. For a Response Payload to exist, the captured message must be defined with a response payload.
<br>
<br>


These payloads are defined as properties for both a [[ascript#ascript.Messages.Item.User|Message User]] and a [[ascript#ascript.Messages.Item.Owner|Message Owner]]. By being part of both user and owner allows their values can be checked for validity in the event that a message didn't make it from user to owner (or visa-versa).   
These payloads are defined as properties for both a [[AutoScript#ascript.Messages.Item.User|Message User]] and a [[AutoScript#ascript.Messages.Item.Owner|Message Owner]]. By being part of both user and owner allows their values can be checked for validity in the event that a message didn't make it from user to owner (or visa-versa).   
<br>
<br>


Line 35: Line 35:
2. The payload is logged onto the receiving script's event queue.<br>
2. The payload is logged onto the receiving script's event queue.<br>
3. The initiator script continues processing.<br>
3. The initiator script continues processing.<br>
4. Later the receiving script makes a call to [[Events#WaitForEvent|WaitForEvent]] to processing the payload.<br>
4. Later the receiving script makes a call to [[AutoScript_Events#WaitForEvent|WaitForEvent]] to processing the payload.<br>
<br>
<br>
The initiator script was not blocked from continuing processing. <br>
The initiator script was not blocked from continuing processing. <br>
Line 55: Line 55:
3. The Message Owner script makes a call to Broadcast() to broadcast its Response Payload. <br>
3. The Message Owner script makes a call to Broadcast() to broadcast its Response Payload. <br>
4. The Response Payload is placed on the event queue of each of its subscribers.  <br>
4. The Response Payload is placed on the event queue of each of its subscribers.  <br>
5. The Message User script may retrieve messages from its event queue by calling [[Events#WaitForEvent|WaitForEvent()]].<br>
5. The Message User script may retrieve messages from its event queue by calling [[AutoScript_Events#WaitForEvent|WaitForEvent()]].<br>
6. When the Message User script is finished listening for messages, a call to Unsubscribe() is made to cease receiving messages.<br>
6. When the Message User script is finished listening for messages, a call to Unsubscribe() is made to cease receiving messages.<br>
<br>
<br>
Line 74: Line 74:
===== Two-Way Messaging Process =====
===== Two-Way Messaging Process =====
Two-Way Command/Response messaging is synchronous. The process for two-way messages is as follows:<br>
Two-Way Command/Response messaging is synchronous. The process for two-way messages is as follows:<br>
1. The Message User script constructs a Command Payload [[Dynamic Objects|Dynamic Object]].<br>
1. The Message User script constructs a Command Payload [[AutoScript_Dynamic_Objects|Dynamic Object]].<br>
2. The Message User script makes a call (SendAndRead or SendCmd) to send the Command Payload to the Message Owner script.<br>
2. The Message User script makes a call (SendAndRead or SendCmd) to send the Command Payload to the Message Owner script.<br>
3. The Message User script blocks (in case of SendAndRead) or explicitly would need to read an event from its event queue using [[Events#WaitForEvent|WaitForEvent()]].<br>
3. The Message User script:<br>
3.1. in case of SendAndRead blocks and if the [[AutoScript#Ascript API|RspTimeoutPeriod]] is non-zero and the call does not complete in the specified time, an exception is thrown.<br>
3.2. or explicitly would need to read an event from its event queue using [[AutoScript_Events#WaitForEvent|WaitForEvent()]].<br>
4. The Message Owner script processes the Command Payload.<br>
4. The Message Owner script processes the Command Payload.<br>
5. The Message Owner script performs some processing.<br>
5. The Message Owner script performs some processing.<br>
Line 96: Line 98:
===== One-Way Messaging Process =====
===== One-Way Messaging Process =====
One-Way Command messaging is asynchronous. The process for One-Way messages is as follows:<br>
One-Way Command messaging is asynchronous. The process for One-Way messages is as follows:<br>
1. The Message User script constructs a Command Payload [[Dynamic Objects|Dynamic Object]].<br>
1. The Message User script constructs a Command Payload [[AutoScript_Dynamic_Objects|Dynamic Object]].<br>
2. The Message User script makes a call (SendCmd or SendCmdBypass) to send the Command Payload to the Message Owner.<br>
2. The Message User script makes a call (SendCmd or SendCmdBypass) to send the Command Payload to the Message Owner.<br>
3. The Command Payload is logged onto the event queue for the Message Owner script.<br>
3. The Command Payload is logged onto the event queue for the Message Owner script.<br>
4. The Message User script continues processing.<br>
4. The Message User script continues processing.<br>
5. The Message Owner script eventually reads an event from its event queue using [[Events#WaitForEvent|WaitForEvent()]].<br>
5. The Message Owner script eventually reads an event from its event queue using [[AutoScript_Events#WaitForEvent|WaitForEvent()]].<br>
6. The Message Owner script formulates a Response Payload.<br>
6. The Message Owner script formulates a Response Payload.<br>
7. The Message Owner makes a call (SendRsp) to send its Response Payload to the Message User script.<br>
7. The Message Owner makes a call (SendRsp) to send its Response Payload to the Message User script.<br>
8. The Response Payload is logged onto the event queue for the Message User script.<br>
8. The Response Payload is logged onto the event queue for the Message User script.<br>
9. The Message User eventually reads an event from its event queue using [[Events#WaitForEvent|WaitForEvent()]].<br>
9. The Message User eventually reads an event from its event queue using [[AutoScript_Events#WaitForEvent|WaitForEvent()]].<br>
<br>
<br>


Line 122: Line 124:
* These are the only methods available for this message type. Thus other message methods (e.g. Subscribe/SendCmd) will not be available.
* These are the only methods available for this message type. Thus other message methods (e.g. Subscribe/SendCmd) will not be available.


== <br>ascript.Messages<br> ==


The Messages Collection is a collection of captured [[#ascript.Messages.Item|Message]] objects. <br>


{| cellspacing="0" cellpadding="10" width="100%" border="1"
== Message Methods ==
|-
The message methods available to a message owner or a message user are based upon the message type. This section describes the methods available for the given message types.
| width="150" bgcolor="#66ff99" | '''Member'''<br>
| width="100" bgcolor="#66ff99" | '''Type'''<br>
| bgcolor="#66ff99" | '''Description'''<br>
|-
| valign="top" | '''void ArrangeBy ('''<br>&nbsp;&nbsp;&nbsp;String By [optional], <br>&nbsp;&nbsp;&nbsp;String Order [optional]<br>''')'''
| valign="top" | Method
| valign="top" | Sorts the Messages collection so that indexing by position yields predictable results.<br><br>The 'By' parameter may one of the following: "Name", "SUID", or "Type". The default sorting order is by "Name". This represents how Timers should be sorted in the collection. A runtime exception is thrown if an invalid value is passed<br><br>The 'Order' parameter may be either "Ascending" or "Descending" and is not case sensitive. If not specified, the default is "Ascending". A runtime exception is thrown if a invalid value is passed.
|-
| valign="top" | Count
| valign="top" | Property,<br>'''Read-only''',<br>int
| valign="top" | Returns the number of Messages in this collection.<br>
|-
| valign="top" align="left" width="150" |
[[#ascript.Messages.Item|Message]]&nbsp;'''Item '''(<br>&nbsp;&nbsp;&nbsp; int Index<br>)


| valign="top" | Method<br>
=== Message Owner Methods ===
| valign="top" | Retrieves the message at the given index.<br>
|-
| valign="top" align="left" width="150" |
[[#ascript.Messages.Item|Message]]&nbsp;'''Item '''(<br>&nbsp;&nbsp;&nbsp; String Name<br>)


| valign="top" | Method<br>
| valign="top" | Retrieves the message with the given name.<br>
|}
<br>
=== <br>ascript.Messages.Item<br> ===
The Message object represents a captured message interface in the currently active STRIDE database. A Message object is always a member of the [[#ascript.Messages|Messages]] collection.
{| cellspacing="0" cellpadding="10" width="100%" border="1"
{| cellspacing="0" cellpadding="10" width="100%" border="1"
|-
|-
| width="120" bgcolor="#66ff99" | '''Member'''<br>
| width="240" bgcolor="#66ff99" | &nbsp;<br>
| width="100" bgcolor="#66ff99" | '''Type'''<br>
| align="center" colspan="4" bgcolor="#66ff99" | '''Message Type'''<br>
| bgcolor="#66ff99" | '''Description'''<br>
|-
|-
| Name
| width="240" bgcolor="#66ff99" | '''Method'''<br>
| Property,<br>'''Read-only''',<br>String
| width="90" bgcolor="#66ff99" | '''One-Way Command'''<br>
| Message name.
| width="90" bgcolor="#66ff99" | '''One-Way Response'''<br>
| width="90" bgcolor="#66ff99" | '''Two-Way'''<br>
| width="90" bgcolor="#66ff99" | '''Broadcast'''<br>
|-
|-
| [[#ascript.Messages.Item.Owner|Owner]]
| Broadcast()
| Property,<br>'''Read-only''',<br>Object
| &nbsp;
| Message's owner object.
| &nbsp;
| &nbsp;
| align="center" | [[Image:Send_output.jpg]]
|-
|-
| SUID
| SendRsp()
| Property,<br>'''Read-only''',<br>int
| &nbsp;
| STRIDE Unique Identifier assigned by compiler.
| align="center" | [[Image:Send_output.jpg]]
| align="center" | [[Image:Send_output.jpg]]
| &nbsp;
|-
|-
| Type
| Register()
| Property,<br>'''Read-only''',<br>String
| align="center" | [[Image:Send_output.jpg]]
| Contains message type defined by the SCL declaration. Legal values include:
| &nbsp;
* "OneWayMessage"
| align="center" | [[Image:Send_output.jpg]]
* "OneWayResponse"
| &nbsp;
* "TwoWayMessage"
* "BroadcastMessage"
|-
|-
| [[#ascript.Messages.Item.User|User]]  
| RegisterOverride()
| Property,<br>'''Read-only''',<br>Object
| align="center" | [[Image:Send_output.jpg]]  
| Message's user object.
| &nbsp;
|}
| align="center" | [[Image:Send_output.jpg]]  
 
| &nbsp;
<br>
 
==== ascript.Messages.Item.Owner<br> ====
 
The Message Owner object represents the Owner-side of a [[#ascript.Messages.Item|Message]]. This may be a receiver of a one-way or two-way message. It may also be the broadcaster of a broadcast message. The Owner object may be used to implement the message owner in a script that can be called through the STRIDE Runtime.<br>
This object allows access to the message destination. The message can be routed to any of the following:
<br>
* the original on-target receiver
* a window in STRIDE Studio
* a script running in Studio
<br>
{| cellspacing="0" cellpadding="10" width="100%" border="1"
|-
|-
| width="210" bgcolor="#66ff99" | '''Member'''<br>
| Unregister()
| width="80" bgcolor="#66ff99" | '''Type'''<br>
| align="center" | [[Image:Send_output.jpg]]
| bgcolor="#66ff99" | '''Description'''<br>
| &nbsp;
| align="center" | [[Image:Send_output.jpg]]
| &nbsp;
|-
|-
| '''void Broadcast (void)'''
| UnregisterOverride()
| Method
| align="center" | [[Image:Send_output.jpg]]  
| Broadcast method exists only for Broadcast Messages. This method broadcasts this message to all message users that have subscribed to this message. The Response payload values are marshaled to all subscribed message users. See [[Messaging#Broadcast Messaging|Broadcast Messaging]] for more information.
| &nbsp;
|-
| align="center" | [[Image:Send_output.jpg]]  
| [[Dynamic Objects|Command]]
| &nbsp;
| Property,<br>'''Read-only''',<br>Object
| This property is a [[Dynamic Objects|Dynamic Object]] representing the Command payload of the Message Owner. The property exists only if the captured message took one or more parameters. The property contains all the values of the Message User Command fields at the time that the message User called the Owner. See [[Messaging#Message Payloads|Message Payloads]] for more information.
|-
| IsOverrideRegistered
| Property,<br>'''Read-only''',<br>boolean
| Contains the override Owner registration state of the message. True only if there is a registered override owner. See [[Messaging#Ownership vs. Usage|Ownership vs. Usage]] for more information.
|-
| IsRegistered
| Property,<br>'''Read-only''',<br>boolean
| Contains the Owner registration state of the message. True only if there is a registered owner, a registered override owner, or both. See [[Messaging#Ownership vs. Usage|Ownership vs. Usage]] for more information.
|-
| Name
| Property,<br>'''Read-only''',<br>String
| Contains Message name.
|-
| '''void Register (void)'''
| Method
| This method only exists for One-Way Command or Two-Way Messages. The calling script is registered as the active owner of the message. If there is already a registered owner or if there is some other registration failure, an exception is thrown. See [[Messaging#Ownership vs. Usage|Ownership vs. Usage]] for more information.
|-
| '''void RegisterOverride (void)'''
| Method
| This method only for One-Way Command or Two-Way Messages. The calling script is registered as the registered override owner (such that all future messages are routed to this owner over and above the registered owner). If there is already an override owner or if there is another registration failure, an exception is thrown. See [[Messaging#Ownership vs. Usage|Ownership vs. Usage]] for more information.
|-
| [[Dynamic Objects|Response]]
| Property,<br>'''Read-only''',<br>Object
| This property is a [[Dynamic Objects|Dynamic Object]] representing the Response payload of the Message Owner. The property exists only if the message is defined with a response payload. See [[Messaging#Message Payloads|Message Payloads]] for more information.
|-
| '''void SendRsp (void)'''
| Method
| Send response method exists only for One-Way Response or Two-Way Messages. The method sends the message as a response to a prior message command from a message user. If there is not pending message response expected an exception is thrown. After setting values of the response payload, a script that implements an Owner message calls SendRsp() to reply to an earlier two-way message (or one-way response). The effect of this call on the calling (User) script depends on how the earlier user message was sent. See [[Messaging#Point-to-Point Messaging|Point-to-Point Messaging]] for more information.
|-
| SUID
| Property,<br>'''Read-only''',<br>int
| STRIDE Unique Identifier assigned by compiler.
|-
| Type
| Property,<br>'''Read-only''',<br>String
| Contains message type defined by the SCL declaration. Legal values include:
* "OneWayMessage"
* "OneWayResponse"
* "TwoWayMessage"
* "BroadcastMessage"
|-
| '''void Unregister (void)'''
| Method
| This method only exists for One-Way Command or Two-Way Messages. This method unregisters the current script as the owner of the message. If the current script is not the registered owner or if unregistration fails, an exception is thrown. See [[Messaging#Ownership vs. Usage|Ownership vs. Usage]] for more information.
|-
| '''void UnregisterOverride (void)'''
| Method
| This method exists only for One-Way Command or Two-Way Messages. This method unregisters the current script as registered override owner. If the current script is not the registered override owner or if registration fails, an exception is thrown. See [[Messaging#Ownership vs. Usage|Ownership vs. Usage]] for more information.
|}
|}


<br>
=== Message User Methods ===
 
== Message Methods ====
The message methods available to a message owner or a message user are based upon the message type. This section describes the methods available for the given message types.
 
=== Message Owner Methods ===


{| cellspacing="0" cellpadding="10" width="100%" border="1"
{| cellspacing="0" cellpadding="10" width="100%" border="1"
|-
| width="240" bgcolor="#66ff99" | &nbsp;<br>
| align="center" colspan="4" bgcolor="#66ff99" | '''Message Type'''<br>
|-
|-
| width="240" bgcolor="#66ff99" | '''Method'''<br>
| width="240" bgcolor="#66ff99" | '''Method'''<br>
| width="240" bgcolor="#66ff99" | '''Message Type'''<br>
|-
| width="240" bgcolor="#66ff99" | '''Method \ Message Type'''<br>
| width="90" bgcolor="#66ff99" | '''One-Way Command'''<br>
| width="90" bgcolor="#66ff99" | '''One-Way Command'''<br>
| width="90" bgcolor="#66ff99" | '''One-Way Response'''<br>
| width="90" bgcolor="#66ff99" | '''One-Way Response'''<br>
Line 281: Line 192:
| width="90" bgcolor="#66ff99" | '''Broadcast'''<br>
| width="90" bgcolor="#66ff99" | '''Broadcast'''<br>
|-
|-
| Broadcast()
| SendAndRead()
|  
| &nbsp;
|
| &nbsp;
|
| align="center" | [[Image:Send_output.jpg]]
| X
| align="center" | [[Image:Send_output.jpg]]
|-
|-
| SendRsp()
| SendAndReadBypassOverride()
|
| &nbsp;
| X
| &nbsp;
| X
| align="center" | [[Image:Send_output.jpg]]
|
| &nbsp;
|-
|-
| Register()
| SendCmd()
| X
| align="center" | [[Image:Send_output.jpg]]
|
| &nbsp;
| X
| align="center" | [[Image:Send_output.jpg]]
|
| &nbsp;
|-
|-
| RegisterOverride()
| SendCmdBypassOverride()
| X
| align="center" | [[Image:Send_output.jpg]]
|
| &nbsp;
| X
| align="center" | [[Image:Send_output.jpg]]
|
| &nbsp;
|-
|-
| Unregister()
| Subscribe()
| X
| &nbsp;
|
| &nbsp;
| X
| &nbsp;
|
| align="center" | [[Image:Send_output.jpg]]
|-
|-
| UnregisterOverride()
| UnSubscribe()
| X
| &nbsp;
|
| &nbsp;
| X
| &nbsp;
|
| align="center" | [[Image:Send_output.jpg]]
|}
|}
[[Category:Studio:AutoScript]]

Latest revision as of 16:06, 21 August 2009

 

STRIDE offers many types of messaging as well as many options on messaging. For ease of understanding, this section describes overall concepts and then describes the precise functionality that STRIDE provides.

Ownership vs. Usage

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. A Message Owner may be on the host or the target. A Message User may be on the host or target.

Message User

A Message User may be any script that is not registered as the message owner or message override owner. The Message User may be access via the message as ascript.Messages.Item.User.

Message Owner

The Message Owner is the script that has successfully registered itself as the owner of the message (by calling the Register method). A message will only have one registered owner. Calls to register a second owner will result in an exception will be thrown. Ownership can be surrendered by calling the Unregister method (or by exiting the script that registered ownership). The Message Owner may be accessed via ascript.Messages.Item.Owner.

Override Owner

The Message Override Owner of a message is the script that successfully registered as the override owner (using the RegisterOverride method). An override owner is used to bypass the registered owner. If a message has an override owner registered, message transfers are sent to the registered override owner and not the registered owner. This allows the ability to code scripting with the registered owner, but to bypass the registered owner for certain processing for a variety of reasons (i.e. some code not implemented for the registered owner, some exception cases, etc.). It is legal for a script to declare both forms of message ownership. Thus, the same script may be both registered owner and the registered override owner.

Message Payloads

Payloads are Dynamic Objects containing data related to a message. A One-Way Command message may have a Command Payload. A One-Way Response message may have a Response Payload. A Two-Way Message may have both a Command Payload and a Response Payload. The word 'may' is used here because these are the legal conditions of what payloads may exist. For a Command Payload to exist, the captured message must take one or more parameters. For a Response Payload to exist, the captured message must be defined with a response payload.

These payloads are defined as properties for both a Message User and a Message Owner. By being part of both user and owner allows their values can be checked for validity in the event that a message didn't make it from user to owner (or visa-versa).

Synchronous / Asynchronous Messaging

Messages that are sent between a Message Owner and a Message User will be either asynchronous or synchronous.

Asynchronous

An asynchronous message is also known as a "non-blocking" message. This is the type of messaging that occurs for Broadcast messaging, One-Way Command messaging, and One-Way Response messaging. For asynchronous messaging:
1. The initiator script of the action makes a call to transfer a payload (either a command or response).
2. The payload is logged onto the receiving script's event queue.
3. The initiator script continues processing.
4. Later the receiving script makes a call to WaitForEvent to processing the payload.

The initiator script was not blocked from continuing processing.

Synchronous

A synchronous message is also known as a "blocking" message. Only a Two-Way message is synchronous for STRIDE. For synchronous messaging:
1. The initiator script makes a call to transfer a command payload.
2. The initiator script then waits until the receiving script provides a response (perhaps with a response payload).

The initiator script was blocked from continuing processing until the receiving script responded.

Messaging Types

Broadcast Messaging

Broadcast Messaging Process

Broadcast messaging is the simplest form of asynchronous messaging. All broadcast messages are asynchronous (there is no synchronous form). The process for broadcast messages is as follows:

1. A Message User script makes a call to Subscribe() to listen for messages.
2. The Message Owner script constructs a Response Payload.
3. The Message Owner script makes a call to Broadcast() to broadcast its Response Payload.
4. The Response Payload is placed on the event queue of each of its subscribers.
5. The Message User script may retrieve messages from its event queue by calling WaitForEvent().
6. When the Message User script is finished listening for messages, a call to Unsubscribe() is made to cease receiving messages.

Broadcast Messaging Methods

For a broadcast message (a message whose ascript.Messages.Item().Type is "BroadcastMessage"):

  • Its Message Owner (ascript.Messages.Item().Owner) will have a Broadcast method.
  • Its Message 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.

Point-To-Point Messaging

Point-to-Point messaging refers to messaging where there is a single sender and a single receiver for a message (as opposed to broadcast messaging with multiple receivers). Point-to-Point messages are either Two-Way or One-Way.

Two-Way Messaging

Two-Way Messaging Process

Two-Way Command/Response messaging is synchronous. The process for two-way messages is as follows:
1. The Message User script constructs a Command Payload Dynamic Object.
2. The Message User script makes a call (SendAndRead or SendCmd) to send the Command Payload to the Message Owner script.
3. The Message User script:
3.1. in case of SendAndRead blocks and if the RspTimeoutPeriod is non-zero and the call does not complete in the specified time, an exception is thrown.
3.2. or explicitly would need to read an event from its event queue using WaitForEvent().
4. The Message Owner script processes the Command Payload.
5. The Message Owner script performs some processing.
6. The Message Owner script constructs a Response Payload.
7. The Message Owner script makes a SendRsp call to return its Response Payload.
8. The Message User script receives the Response Payload and processes it.

Two-Way Messaging Methods

For a two-way message (a message whose ascript.Messages.Item().Type is "TwoWayMessage"):

  • Its Message Owner (ascript.Messages.Item().Owner) will have a SendRsp method.
  • Its Message User object (ascript.Messages.Item().User) will have a SendCmd and SendAndRead methods as well as SendCmdBypassOverride and SendAndReadBypassOverride methods.
  • These are the only methods available for this message type. Thus other message methods (e.g. Subscribe) will not be available.

One-Way Messaging

One-Way Messaging Process

One-Way Command messaging is asynchronous. The process for One-Way messages is as follows:
1. The Message User script constructs a Command Payload Dynamic Object.
2. The Message User script makes a call (SendCmd or SendCmdBypass) to send the Command Payload to the Message Owner.
3. The Command Payload is logged onto the event queue for the Message Owner script.
4. The Message User script continues processing.
5. The Message Owner script eventually reads an event from its event queue using WaitForEvent().
6. The Message Owner script formulates a Response Payload.
7. The Message Owner makes a call (SendRsp) to send its Response Payload to the Message User script.
8. The Response Payload is logged onto the event queue for the Message User script.
9. The Message User eventually reads an event from its event queue using WaitForEvent().

One-Way Messaging Methods

For a One-Way Command message (a message whose ascript.Messages.Item().Type is "OneWayMessage"):

  • Its Message User (ascript.Messages.Item().User) will have a SendCmd method as well as a SendCmdBypassOverride method.
  • These are the only methods available for this message type. Thus other message methods (e.g. Subscribe/SendCmd) will not be available.


For a One-Way Response message (a message whose ascript.Messages.Item().Type is "OneWayResponse"):

  • Its Message Owner (ascript.Messages.Item().Owner) will have a SendRsp method.
  • These are the only methods available for this message type. Thus other message methods (e.g. Subscribe/SendCmd) will not be available.


Message Methods

The message methods available to a message owner or a message user are based upon the message type. This section describes the methods available for the given message types.

Message Owner Methods

 
Message Type
Method
One-Way Command
One-Way Response
Two-Way
Broadcast
Broadcast()       Send output.jpg
SendRsp()   Send output.jpg Send output.jpg  
Register() Send output.jpg   Send output.jpg  
RegisterOverride() Send output.jpg   Send output.jpg  
Unregister() Send output.jpg   Send output.jpg  
UnregisterOverride() Send output.jpg   Send output.jpg  

Message User Methods

 
Message Type
Method
One-Way Command
One-Way Response
Two-Way
Broadcast
SendAndRead()     Send output.jpg Send output.jpg
SendAndReadBypassOverride()     Send output.jpg  
SendCmd() Send output.jpg   Send output.jpg  
SendCmdBypassOverride() Send output.jpg   Send output.jpg  
Subscribe()       Send output.jpg
UnSubscribe()       Send output.jpg