This is a small, high performance framework designed to help you build servers. The framework takes care of managing the server sockets, listening for new connections, sending data to and receving data from these connections. It uses events to notify your code when a client is connecting/disconnecting or when data is available from a particular client. Your code can then do what it needs to do with that data and reply to the client. The client communication is abstracted behind connection objects and is handled by the framework, so you don't have to deal with it.
The framework also provides you with a file structure to organize your projects. Your code goes in either the wrappers/ directory or the app/ depending on what you need to build. Implementations of TCP based protocols (like HTTP, WebSocket, SMTP, etc.) go in the wrappers/ dir. Application level code that in turn works over those protocols goes in the app/ directory. For example if you want to make REST API that works over HTTP, the code for it will go in the app/ directory.
This is not an MVC framework. You should NOT expect to run standard web applications (like Wordpress) on it. It is not stateless and the process does not die after servicing a an HTTP request for example. DO NOT call exit in your code or your server will stop and nobody will be able to connect until you restart it!
First you need to decide whether you need to build a wrapper or a component (components work over the wrappers and go in the app/ directory). Usually, you will build your wrapper first and then build your app (component) logic on top of that wrapper. The framework already provides wrappers for HTTP, WebSocket and SMTP, so if you are going to be building on top of one of these protocols you can go straight to building the app (component). Please read through the Building a Wrapper and Building a Component pages for further information on how to do these things.
The framework can manage an arbitrary amount of servers, but please be mindful that if an application running on server A responds slower to requests than an application running on server B, then this can affect the performance of the application on server B. The way you configure what servers to run is through the config.php file. Here is what a demo config file looks like:
$server_config = array(
65000 => array(
'WebSocket' => array(
'hosts' => array(
'localhost' => array('WebChat', 'SimpleEcho'),
)
),
'ssl' => array(
'cert_file' => '',
'privkey_file' => '',
'passphrase' => ''
)
),
65001 => array(
'RawTcp' => array()
),
65002 => array(
'Http' => array(
'hosts' => array(
'localhost' => array('HelloWorld', 'Maintenance'),
)
),
'ssl' => array(
'cert_file' => 'cert.pem',
'privkey_file' => 'key.pem',
'passphrase' => ''
)
)
);
This is an array that describes which ports to listen on and what wrappers to use for each port. You can optionally add wrapper specific config, or if this is not suported use an empty array. The config above starts 3 servers one on each of these ports 65000, 65001 and 65002. On port 65000 we have a WebSocket server, then the RawTcp wrapper is used for port 65001 (this wrapper does nothing basically) and finally we have a secure HTTP wrapper on port 65002. The files cert.pem and key.pem are in the same format as you would prepare them for NGINX for example. That means putting the complete chain in cert.pem.