Class Server
The Server class implements the ServerInterface and
is responsible for accepting plaintext TCP/IP connections.
`php $server = new Server(8080, $loop); `
Whenever a client connects, it will emit a connection event with
a connection instance implementing ConnectionInterface:
`php $server->on('connection', function (ConnectionInterface
$connection) { echo 'Plaintext connection from ' .
$connection->getRemoteAddress() . PHP_EOL; $connection->write('hello
there!' . PHP_EOL); … }); `
See also the ServerInterface for more details.
Note that the Server class is a concrete implementation for
TCP/IP sockets. If you want to typehint in your higher-level protocol
implementation, you SHOULD use the generic ServerInterface
instead.
- Evenement\EventEmitter implements Evenement\EventEmitterInterface uses Evenement\EventEmitterTrait
-
React\Socket\Server
implements
React\Socket\ServerInterface
Namespace: React\Socket
See:
React\Socket\ServerInterfaceSee:
React\Socket\ConnectionInterfaceLocated at Server.php
public
|
#
__construct( string|integer $uri,
Creates a plaintext TCP/IP socket server and starts listening on the given address |
public
?string
|
|
public
|
|
public
|
|
public
|
emit(),
listeners(),
on(),
once(),
removeAllListeners(),
removeListener()
|
(),
(),
(),
(),
(),
()
|
$listeners
|