- start-server bind-addr backlog user->key open-handler request-handler close-handlerprocedure
Starts a bokbok server in a thread, and returns a server object.
bind-addr is the address to bind to, either (unix PATH) for a Unix-domain socket or (tcp ADDRESS PORT) for a TCP socket. An ADDRESS of #f causes it to bind on all available addresses.
backlog is the listen backlog. This is a slightly mysterious tuning parameter that can matter in highly-loaded systems. Try using 10.
user->key, if provided, is a callback closure invoked to authenticate and authorize encrypted connections. It is passed a username string, and must return a key object that matches the key object used by the client when opening the connection. Attach it to whatever passes for a database of users on the server. It should return #f for an unrecognised or otherwise not allowed to connect username. If #f is provided, then the server listens for insecure connections.
open-handler is a callback closure invoked whenever a new connection is made to the server. It is applied to the connection object.
request-handler is a callback closure invoked whenever the client sends a request to the server on any connection, as explained above under open-connection.
close-handler is a callback closure invoked when the client closes a connection. It is applied to the connection object.