CS and API docs
This commit is contained in:
parent
710ec2535f
commit
5f80c291b7
@ -1,6 +1,10 @@
|
||||
<?php
|
||||
namespace Ratchet;
|
||||
|
||||
/**
|
||||
* Wraps ConnectionInterface objects via the decorator pattern but allows
|
||||
* parameters to bubble through with magic methods
|
||||
*/
|
||||
abstract class AbstractConnectionDecorator implements ConnectionInterface {
|
||||
/**
|
||||
* @var ConnectionInterface
|
||||
|
@ -3,6 +3,10 @@ namespace Ratchet;
|
||||
|
||||
const VERSION = 'Ratchet/0.1';
|
||||
|
||||
/**
|
||||
* A proxy object representing a connection to the application
|
||||
* This acts as a container to storm data (in memory) about the connection
|
||||
*/
|
||||
interface ConnectionInterface {
|
||||
/**
|
||||
* Send data to the connection
|
||||
|
@ -4,8 +4,7 @@ use Ratchet\ConnectionInterface;
|
||||
use React\Socket\ConnectionInterface as ReactConn;
|
||||
|
||||
/**
|
||||
* A proxy object representing a connection to the application
|
||||
* This acts as a container to storm data (in memory) about the connection
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
class IoConnection implements ConnectionInterface {
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Ratchet\Wamp;
|
||||
|
||||
class JSONException extends Exception {
|
||||
class JsonException extends Exception {
|
||||
public function __construct() {
|
||||
$code = json_last_error();
|
||||
|
@ -5,6 +5,8 @@ use Ratchet\AbstractConnectionDecorator;
|
||||
use Ratchet\Wamp\WampServer as WAMP;
|
||||
|
||||
/**
|
||||
* A ConnectionInterface object wrapper that is passed to your WAMP application
|
||||
* representing a client. Methods on this Connection are therefore different.
|
||||
* @property stdClass $WAMP
|
||||
*/
|
||||
class WampConnection extends AbstractConnectionDecorator {
|
||||
|
@ -72,13 +72,13 @@ class WampServer implements WsServerInterface {
|
||||
/**
|
||||
* @{inheritdoc}
|
||||
* @throws Exception
|
||||
* @throws JSONException
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function onMessage(ConnectionInterface $from, $msg) {
|
||||
$from = $this->connections[$from];
|
||||
|
||||
if (null === ($json = @json_decode($msg, true))) {
|
||||
throw new JSONException;
|
||||
throw new JsonException;
|
||||
}
|
||||
|
||||
switch ($json[0]) {
|
||||
|
@ -3,6 +3,7 @@ namespace Ratchet\WebSocket;
|
||||
use Ratchet\AbstractConnectionDecorator;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @property stdClass $WebSocket
|
||||
*/
|
||||
class WsConnection extends AbstractConnectionDecorator {
|
||||
|
Loading…
Reference in New Issue
Block a user