Simple_httpd.IoSourceModule that encapsulates non blocking sockets with function similar to Unix.read and Unix.single_write but that will perform scheduling instead of blocking. This can be used to access your database. It has been tested with OCaml's bindings to libpq.
Io can be shared across several clients, for instance clients using the same session. As always, be aware of protecting concurrent access to the socket, as different client may run simultaneously on different domain.
Io is completely useless on regular file or blocking sockets.
val create :
?edge_triggered:bool ->
?finalise:(t -> unit) ->
?client:Client.t ->
Unix.file_descr ->
tEncapsulate a file descriptor in a dedicated data structure. finalise default to Unix.close Io.sock.
If client is provided, the ressource is atatched to the client and destroyed (call to finalise) when the client is closed.
Not suitable for file descriptor using SSL, unless kernel tls is used.
Returns the socket, usefull in finalise or to set some socket properties, do not attempt to read/write the socket.
Provide a formatter to use with the Format library