Obol scripts tend to follow a similar pattern, but the only real restriction are dependencies; specifically, inputs must be specified by [input] statements before being used. Any mention of "application" refers to the software using the Obol runtime or a particular script.
The header:
Decide which input the script needs, and specify the appropriate [input] metacommands. Remember, the script will not execute non-metacommands unless the application sets all required inputs.
If the script returns any output, specify that with [returns] metacommands.
Decide where the script should look for incoming messages by using the [self] metacommand, which also configures receive modes.
Optionally specify the message representation format to use for constructing messages (also for cryptographic operations), by means of the [format] metacommand,
Initialization of local state. This includes generation of various data, loading keys, and the like.
Constructing and sending the first message, or expecting the first incoming message.
The protocol proper.
Termination. This phase may include setting return values or error messages.
(a)
(script "Server"
[input portNo number]
[returns data string]
[self portNo default
:poolmode]
[format default]
(receive *client *data)
(believe data *data
((type string))))
(b)
(script "Client"
[input portNo number]
(believe data
"Hello World!")
(believe server
"127.0.0.1"
((port portNo)))
(send server data))
Here is a "Hello World" type client-server pair showing the aforementioned pattern for (a) server; (b) client.