User Tools

Site Tools


dwsc:servercontrol:msg

This is an old revision of the document!


DWSC control module

Message format

Message serializer: MessagePack

Request:

class DWSCReq {
        public $v  = 1;         // version
        public $id = 0;         // message ID
        public $at = null;      // auth token
        public $s  = "";        // source: <host>
        public $t  = "";        // target: edge | origin | <host>
        public $vh = "";        // virtual host
        public $a  = "";        // application
        public $c  = 0;         // command: DWSCCmd
        public $p  = null;      // parameter array

        public function DWSCReq() {
                $this->p = array();
        }
};

Reply:

class DWSCRep {
        public $v    = 1;       // version
        public $eno  = 0;       // error code
        public $estr = "";      // error string
        public $d    = null;    // reply data
}

Commands:

class DWSCCmd {
        const LOAD                      = 1;
        const SUSPEND                   = 2;
        const STOP                      = 3;
        const SUSPEND                   = 4;
        const DISCONNECT_CLIENTS        = 5;
}

msgpack example:

$msg = new DWSCReq();
$msg->c = DWSCCmd::STOP;

$msgpack = new MessagePack(false); // false = disable PHP_ONLY mode
$smsg = $msgpack->pack($msg);

echo var_export(msgpack_unserialize($smsg), true);
dwsc/servercontrol/msg.1364846115.txt.gz · Last modified: 2013/04/01 21:55 by ivan