public function dispatchMessage(Message $message, $eventNamePrefix = "")
{
if ($eventNamePrefix == "") {
$this->lastInboundActivity = microtime(true);
$this->messagesReceived++;
}
// this could probably become a constant inside the message itself
$r = new \ReflectionClass($message);
$shortName = $r->getShortName();
if ($message instanceof HelloMessage) {
$this->dispatcher->dispatch("Pre" . $shortName . "Event", new MessageEvent($this, $message));
}
$this->dispatcher->dispatch($eventNamePrefix . $shortName . "Event", new MessageEvent($this, $message));
}