Skip to content

Instantly share code, notes, and snippets.

@dwolfhub
Created April 24, 2014 20:52
Show Gist options
  • Save dwolfhub/11269116 to your computer and use it in GitHub Desktop.
Save dwolfhub/11269116 to your computer and use it in GitHub Desktop.
Chatter MessageComponentInterface implementation
<?php
namespace Chatter;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;
class Chatter implements MessageComponentInterface {
/**
* When connection is opened
*
* @param ConnectionInterface $conn
* @return Void
*/
public function onOpen(ConnectionInterface $conn) {}
/**
* When message is received
*
* @param ConnectionInterface $from
* @param String $msg
* @return Void
*/
public function onMessage(ConnectionInterface $from, $msg) {}
/**
* When connection is closed
*
* @param ConnectionInterface $conn
* @return Void
*/
public function onClose(ConnectionInterface $conn) {}
/**
* When a connection error occurs
*
* @param ConnectionInterface $conn
* @param Exception $e
* @return Void
*/
public function onError(ConnectionInterface $conn, \Exception $e) {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment