This function forks to create the listening socket and takes care of all initialization in one step.The callback function is called for a handful of events including http requests coming in, websocket connections becoming established, and data arriving; it's also called periodically to allow async transmission.
The server created is a simple http server by default; part of the websocket standard is upgrading this http connection to a websocket one.
This allows the same server to provide files like scripts and favicon / images or whatever over http and dynamic data over websockets all in one place; they're all handled in the user callback.
The user code can find out the local path being opened from this call, it's valid on HTTP or established websocket connections. If the client opened the connection with "http://127.0.0.1/xyz/abc.d" then this call will return a pointer to "/xyz/abc.d"
This function provides the way to issue data back to the client for both http and websocket protocols.In the case of sending using websocket protocol, be sure to allocate valid storage before and after buf as explained above. This scheme allows maximum efficiency of sending data and protocol in a single packet while not burdening the user code with any protocol knowledge.
This function is intended to be called from the callback in response to http requests from the client. It allows the callback to issue local files down the http link in a single step.