Dialers

From OnixOS

Dialer functions can automatically initiate a socket or provide sockete access and automatically communicate over a socket.

dial_serve.ola (dial serve example):

sock socket "tcp4" "9050" "0.0.0.0"; 

def messages = { 
   "ping”: "pong”, 
   "call”: "Calling… NOPE! :)”, 
   "help”: "Not helpfull!” 
} 

sock_listen(socket, messages)

The 9050 port is ready to connect.

dial_client.ol (dial client example):

sock socket "tcp4" "9050" "0.0.0.0";
def send = fn(message){
  output(sock_send(socket, message))
} 
send("call")
send("help")

Output:

Calling... NOPE! :)
Not helpfull!