Wrench\ConnectionManager¶
-
class
ConnectionManager¶ -
property
server¶ protected Server
-
property
socket¶ protected Socket
Master socket
-
property
connections¶ protected array<int
An array of client connections
-
property
resources¶ protected array<int
An array of raw socket resources, corresponding to connections, roughly
-
property
options¶ protected array
-
property
protocol¶ protected Protocol
-
__construct(Server $server, $options = array())¶ Constructor
Parameters: - $server (Server) –
- $options (array) –
-
count()¶
-
configure($options)¶ Parameters: - $options –
-
getApplicationForPath($path)¶ Gets the application associated with the given path
Parameters: - $path (string) –
-
configureMasterSocket()¶ Configures the main server socket
-
listen()¶ Listens on the main socket
Returns: void
-
getAllResources()¶ Gets all resources
Returns: array<int => resource)
-
getConnectionForClientSocket($socket)¶ Returns the Connection associated with the specified socket resource
Parameters: - $socket (resource) –
Returns: Connection
-
selectAndProcess()¶ Select and process an array of resources
-
processMasterSocket()¶ Process events on the master socket ($this->socket)
Returns: void
-
createConnection($resource)¶ Creates a connection from a socket resource
The create connection object is based on the options passed into the constructor (‘connection_class’, ‘connection_options’). This connection instance and its associated socket resource are then stored in the manager.
Parameters: - $resource (resource) – A socket resource
Returns: Connection
-
processClientSocket($socket)¶ Process events on a client socket
Parameters: - $socket (resource) –
-
resourceId($resource)¶ This server makes an explicit assumption: PHP resource types may be cast to a integer. Furthermore, we assume this is bijective. Both seem to be true in most circumstances, but may not be guaranteed.
This method (and $this->getResourceId()) exist to make this assumption explicit.
This is needed on the connection manager as well as on resources
Parameters: - $resource (resource) –
-
getUri()¶ Gets the connection manager’s listening URI
Returns: string
-
log($message, $priority = 'info')¶ Logs a message
Parameters: - $message (string) –
- $priority (string) –
-
getServer()¶ Returns: WrenchServer
-
removeConnection(Connection $connection)¶ Removes a connection
Parameters: - $connection (Connection) –
-
configureProtocol()¶ Configures the protocol option
-
property