Define your incoming and outgoing ports.
Here we’re using String as the data exchange format, but you may want to use JSON for more power and control.
See Json.Decode
and Json.Encode.
Use commands to send outgoing messages:
Use subscriptions to receive incoming messages:
Compile your program to a javascript file:
Create an html file that starts your program like this: