public function onMessage(SocketEvent $evt)
 {
     $message = $evt->getMessage();
     $broadcast = sprintf('received message [%s] at %s', $message, time());
     if ($evt->getStream()->serializer === $this->socketServer) {
         $this->logger->debug('server instances are the same');
     } else {
         $this->logger->debug('servier instances are DIFFERENT');
     }
     $this->socketServer->broadcast($broadcast);
     $this->logger->info(sprintf('broadcast listener has received a message [%s] and is responding to socket', $message));
 }
 protected function processHandshake($input, $socketStream)
 {
     //process handshake
     $this->logger->debug('begin websocket handshake');
     //create handshake response, need to refactor this to response class.
     $request = $this->createHandshakeRequest($input);
     $socketStream->setRequest($request);
     //send data back to client
     $response = $socketStream->shakeHands();
     //notify application of this event.
     $evt = new SocketEvent($socketStream, 'handshake');
     $evt->setMessage($input);
     //dispatching handshake event.
     $this->dispatch($evt);
 }