Some checks are pending
CI / PHPUnit (highest, 5.4) (push) Waiting to run
CI / PHPUnit (highest, 5.5) (push) Waiting to run
CI / PHPUnit (highest, 5.6) (push) Waiting to run
CI / PHPUnit (highest, 7.0) (push) Waiting to run
CI / PHPUnit (highest, 7.1) (push) Waiting to run
CI / PHPUnit (highest, 7.2) (push) Waiting to run
CI / PHPUnit (highest, 7.3) (push) Waiting to run
CI / PHPUnit (highest, 7.4) (push) Waiting to run
CI / PHPUnit (lowest, 5.4) (push) Waiting to run
24 lines
628 B
PHP
24 lines
628 B
PHP
<?php
|
|
namespace mfmdevsystem\socket\Server;
|
|
use mfmdevsystem\socket\MessageComponentInterface;
|
|
use mfmdevsystem\socket\ConnectionInterface;
|
|
|
|
/**
|
|
* A simple Ratchet application that will reply to all messages with the message it received
|
|
*/
|
|
class EchoServer implements MessageComponentInterface {
|
|
public function onOpen(ConnectionInterface $conn) {
|
|
}
|
|
|
|
public function onMessage(ConnectionInterface $from, $msg) {
|
|
$from->send($msg);
|
|
}
|
|
|
|
public function onClose(ConnectionInterface $conn) {
|
|
}
|
|
|
|
public function onError(ConnectionInterface $conn, \Exception $e) {
|
|
$conn->close();
|
|
}
|
|
}
|