Purpose of this Component
This component is responsible for parsing incoming HTTP requests.
It's purpose is to buffer data until it receives a full HTTP header request and pass it on.
You can use this as a raw HTTP server (not advised) but it's meant for upgrading WebSocket requests.
Note: This component is bundled within the App class.
Events triggered by this Component
As found in the API Docs: Triggered events are propagated through a HttpServerInterface object passed to the __construct.
- onOpen (ConnectionInterface $conn, RequestInterface $request = null) - A new client connection has been opened
- onClose (ConnectionInterface $conn) - A client connection is about to, or has closed
- onMessage (ConnectionInterface $from, string $message) - A data message has been received
- onError (ConnectionInterface $from, Exception $error) - An error has occurred with a Connection
Functions callable on Connections
- send (string $message) - Send a message (string) to the client
- close - Gracefully close the connection to the client
Wraps other components nicely
Wrapped by other components nicely
// Your shell script
$http = new HttpServer(new MyWebPage);
$server = IoServer::factory($http);