Added the property socket to the IOServer class and exposed the app and socket properties through getters.
This commit is contained in:
		
							parent
							
								
									a456c50df4
								
							
						
					
					
						commit
						a1c27ac91b
					
				| @ -1,5 +1,7 @@ | ||||
| <?php | ||||
| 
 | ||||
| namespace Ratchet\Server; | ||||
| 
 | ||||
| use Ratchet\MessageComponentInterface; | ||||
| use React\EventLoop\LoopInterface; | ||||
| use React\Socket\ServerInterface; | ||||
| @ -27,6 +29,12 @@ class IoServer { | ||||
|      */ | ||||
|     protected $handlers; | ||||
|      | ||||
|     /** | ||||
|      * The socket server the Ratchet Application is run off of | ||||
|      * @var \React\Socket\ServerInterface | ||||
|      */ | ||||
|     protected $socket; | ||||
| 
 | ||||
|     /** | ||||
|      * @param \Ratchet\MessageComponentInterface  $app      The Ratchet application stack to host | ||||
|      * @param \React\Socket\ServerInterface       $socket   The React socket server to run the Ratchet application off of | ||||
| @ -42,6 +50,7 @@ class IoServer { | ||||
| 
 | ||||
|         $this->loop = $loop; | ||||
|         $this->app  = $app; | ||||
|         $this->socket = $socket; | ||||
| 
 | ||||
|         $socket->on('connection', array($this, 'handleConnect')); | ||||
| 
 | ||||
| @ -51,6 +60,24 @@ class IoServer { | ||||
|         $this->handlers[2] = array($this, 'handleError'); | ||||
|     } | ||||
|      | ||||
|     /** | ||||
|      * Returns the Ratchet App | ||||
|      *  | ||||
|      * @return \Ratchet\MessageComponentInterface | ||||
|      */ | ||||
|     public function getApp() { | ||||
|         return $this->app; | ||||
|     } | ||||
|      | ||||
|     /** | ||||
|      * Returns the Socket | ||||
|      *  | ||||
|      * @return \React\Socket\ServerInterface | ||||
|      */ | ||||
|     public function getSocket() { | ||||
|         return $this->socket; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @param  \Ratchet\MessageComponentInterface $component The application that I/O will call when events are received | ||||
|      * @param  int                                $port      The port to server sockets on | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Gerrit Drost
						Gerrit Drost