Lua primitives: bind_socket()
This function will open a unix domain-socket on the named path, and start listening for commands upon it.
Commands are read once for each iteration around the main event-loop which means that while they will not be processed immediately they should be almost instant.
bind_socket( os.getenv( "HOME" ) .. "/.listening.socket" );
If no path is specified the default is used of "~/.lumail.sock".
The lumail distribution contains a helper command, lumailctl, which is used to send commands to the listening socket - although you may also send input via socat as follows:
echo "exit();" | socat - UNIX-CLIENT:~/.lumail.sock
This function has been available since version 0.25.
See also close_socket.