mxmbsocket/lib/Ratchet/Protocol/WebSocket/Command/Action/Disconnect.php
Chris Boden d880d29729 Refactoring
Refactored Command/Composite pattern, now as expected
Server recursively executes commands
Above changes fixed issues of server/client not being notified on forced disconnects
2011-11-07 16:02:01 -05:00

20 lines
478 B
PHP

<?php
namespace Ratchet\Protocol\WebSocket\Command\Action;
use Ratchet\SocketInterface;
use Ratchet\Command\Action\SendMessage;
use Ratchet\SocketObserver;
class Disconnect extends SendMessage {
protected $_code = 1000;
public function setStatusCode($code) {
$this->_code = (int)$code;
// re-do message based on code
}
public function execute(SocketObserver $scope = null) {
parent::execute();
$this->_socket->close();
}
}