-
Notifications
You must be signed in to change notification settings - Fork 2
connect_method
The AutoRouter CONNECT method is used to establishing connections with itself and with target objects. In addition, AutoRouter can invoke HS target objects automatically.
A local client can receive messages only after AutoRouter establishes local routing services (which creates a receive device for the client). To do this, the local process must send a CONNECT message either to AutoRouter directly, or to the target process it wants to connect with. (To address AutoRouter directly, the target name is "router".) For example, from HS you could call the event method to connect to AutoRouter as follows:
event ( "router", "CONNECT", {} ) ;
``
_
When AutoRouter receives a CONNECT message from a local process, it will establish the local routing service. The local client can perform a lazy poll loop, looking for the read-only device that AutoRouter created, and then open the device as a read-only file.
When a local client sends a CONNECT message to a remote target, it uses AutoRouter remote routing services. For example, to connect to a remote target called object@node, you could use the following HS command:
event ( "object@node", "CONNECT", {} ) ;
``
_
Note that object@node must have its own CONNECT method defined. As noted above, AutoRouter will establish local routing services if necessary using its CONNECT method.
When AutoRouter receives a CONNECT message for which there is no device for the specified target, it will search a special directory (normally AUTORUN) for a HS program with the same name as the target, with extension ".hyp". If a HS file is found, AutoRouter will start it as a detached process, create local routing services for it, and send it the CONNECT message. Once the HS file is loaded and parsed successfully, the program will receive the CONNECT message and execute its own CONNECT method.
For example the target name of object@node will invoke a HS file named "object.hyp" located on the specified node. If the HS process wants to become a unique instance, then it should execute the instantiate method. This will give the HS program a new instance name, for example, 2E4F100B, and the following actions will occur:
- HS sends AutoRouter the message:**
|router|event|disconnect|object@node|
** - AutoRouter unlinks from receive device MBX_OBJECT (see local routing for an explaination)
- HS closes connection to MBX_OBJECT
- HS sends AutoRouter the message:
**|router|event|connect|2E4F100B.object@node|
** - AutoRouter creates receive device MBX_2E4F100B
- HS opens connection to MBX_2E4F100B
If a HS file is not found with the ".hyp" extension, but one exists with a PROMIS standard ".scr" extension, then AutoRouter will start PROMIS as a detached process, create local routing services for it, and put the CONNECT message in the receive device. Once PROMIS is started, it will open the script file, load and parse the embedded HS program, open the receive device, read the CONNECT message, and begin executing the HS at the CONNECT method label. In all other respects, HS/PROMIS is identical to standalone HS.