public function emit($eventName, $message) { $messageEvent = new Event\MessageEvent(); $messageEvent->setMessage(array('event' => $eventName, 'message' => $message)); $messageEvent->setEndpoint($this->endpoint); $dispatcher = Event\EventDispatcher::getDispatcher(); $dispatcher->dispatch("server.emit", $messageEvent, $this->endpoint); return $this; }
protected function dispatchEmitEvent($eventName, $message) { $messageEvent = new Event\MessageEvent(); $messageEvent->setMessage(array('event' => $eventName, 'message' => $message)); $messageEvent->setConnection($this); $dispatcher = Event\EventDispatcher::getDispatcher(); return $dispatcher->dispatch("server.emit", $messageEvent, $this->getSessionId()); }