Hoa central
Node.php
Go to the documentation of this file.
1 <?php
2 
37 namespace Hoa\Websocket;
38 
39 use Hoa\Socket;
40 
49 class Node extends Socket\Node
50 {
56  protected $_protocol = null;
57 
63  protected $_handshake = false;
64 
70  protected $_messageFragments = null;
71 
77  protected $_numberOfFragments = 0;
78 
82  protected $_complete = true;
83 
89  protected $_isBinary = false;
90 
91 
92 
99  public function setProtocolImplementation(Protocol\Generic $protocol)
100  {
101  $old = $this->_protocol;
102  $this->_protocol = $protocol;
103 
104  return $old;
105  }
106 
112  public function getProtocolImplementation()
113  {
114  return $this->_protocol;
115  }
116 
123  public function setHandshake($handshake)
124  {
125  $old = $this->_handshake;
126  $this->_handshake = $handshake;
127 
128  return $old;
129  }
130 
136  public function getHandshake()
137  {
138  return $this->_handshake;
139  }
140 
147  public function appendMessageFragment($fragment)
148  {
149  ++$this->_numberOfFragments;
150 
151  return $this->_messageFragments .= $fragment;
152  }
153 
159  public function getFragmentedMessage()
160  {
161  return $this->_messageFragments;
162  }
163 
169  public function getNumberOfFragments()
170  {
171  return $this->_numberOfFragments;
172  }
173 
180  public function setComplete($complete)
181  {
182  $old = $this->_complete;
183  $this->_complete = $complete;
184 
185  return $old;
186  }
187 
193  public function isMessageComplete()
194  {
195  return $this->_complete;
196  }
197 
204  public function setBinary($binary)
205  {
206  $old = $this->_isBinary;
207  $this->_isBinary = $binary;
208 
209  return $old;
210  }
211 
217  public function isBinary()
218  {
219  return $this->_isBinary;
220  }
221 
227  public function clearFragmentation()
228  {
229  unset($this->_messageFragments);
230  $this->_numberOfFragments = 0;
231  $this->_isBinary = false;
232  $this->_complete = true;
233 
234  return;
235  }
236 }
setComplete($complete)
Definition: Node.php:180
setHandshake($handshake)
Definition: Node.php:123
getNumberOfFragments()
Definition: Node.php:169
appendMessageFragment($fragment)
Definition: Node.php:147
setProtocolImplementation(Protocol\Generic $protocol)
Definition: Node.php:99
getFragmentedMessage()
Definition: Node.php:159
setBinary($binary)
Definition: Node.php:204
getProtocolImplementation()
Definition: Node.php:112