From 118923e784070fe366ed5ee50166ca78541441ee Mon Sep 17 00:00:00 2001 From: Chris Boden <cboden@gmail.com> Date: Sat, 12 Nov 2011 13:50:30 -0500 Subject: [PATCH] Messaging Interfaces Added Messaging and Framing Interfaces --- .../Protocol/WebSocket/FrameInterface.php | 55 +++++++++++++++++++ .../Protocol/WebSocket/MessageInterface.php | 32 +++++++++++ 2 files changed, 87 insertions(+) create mode 100644 lib/Ratchet/Protocol/WebSocket/FrameInterface.php create mode 100644 lib/Ratchet/Protocol/WebSocket/MessageInterface.php diff --git a/lib/Ratchet/Protocol/WebSocket/FrameInterface.php b/lib/Ratchet/Protocol/WebSocket/FrameInterface.php new file mode 100644 index 0000000..5b500e5 --- /dev/null +++ b/lib/Ratchet/Protocol/WebSocket/FrameInterface.php @@ -0,0 +1,55 @@ +<?php +namespace Ratchet\Protocol\WebSocket; + +interface FrameInterface { + /** + * @return bool + */ + function isCoalesced(); + + /** + * @param string + */ + function addBuffer($buf); + + /** + * @return bool + */ + function isFragment(); + + /** + * @return bool + */ + function isFinial(); + + /** + * @return bool + */ + function isMasked(); + + /** + * @return int + */ + function getOpcode(); + + /** + * @return int + */ + function getPayloadLength(); + + /** + * @return int + */ + function getReceivedPayloadLength(); + + /** + * 32-big string + * @return string + */ + function getMaskingKey(); + + /** + * @param string + */ + function getPayload(); +} \ No newline at end of file diff --git a/lib/Ratchet/Protocol/WebSocket/MessageInterface.php b/lib/Ratchet/Protocol/WebSocket/MessageInterface.php new file mode 100644 index 0000000..9053fb2 --- /dev/null +++ b/lib/Ratchet/Protocol/WebSocket/MessageInterface.php @@ -0,0 +1,32 @@ +<?php +namespace Ratchet\Protocol\WebSocket; + +/** + * @todo Consider making parent interface/composite for Message/Frame with (isCoalesced, getOpcdoe, getPayloadLength, getPayload) + */ +interface MessageInterface { + /** + * @return bool + */ + function isCoalesced(); + + /** + * @param FragmentInterface + */ + function addFragment(FragmentInterface $fragment); + + /** + * @return int + */ + function getOpcode(); + + /** + * @return int + */ + function getPayloadLength(); + + /** + * @return string + */ + function getPayload(); +} \ No newline at end of file