Fixed failing UTF-8 tests, increased performance
This commit is contained in:
parent
791ebaeb24
commit
1c6a486e8a
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Ratchet\RFC6455\Messaging\Protocol;
|
namespace Ratchet\RFC6455\Messaging\Protocol;
|
||||||
|
|
||||||
class Message implements MessageInterface {
|
class Message implements \IteratorAggregate, MessageInterface {
|
||||||
/**
|
/**
|
||||||
* @var \SplDoublyLinkedList
|
* @var \SplDoublyLinkedList
|
||||||
*/
|
*/
|
||||||
@ -14,6 +14,10 @@ class Message implements MessageInterface {
|
|||||||
$this->_frames = new \SplDoublyLinkedList;
|
$this->_frames = new \SplDoublyLinkedList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getIterator() {
|
||||||
|
return $this->_frames;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Ratchet\RFC6455\Messaging\Protocol;
|
namespace Ratchet\RFC6455\Messaging\Protocol;
|
||||||
|
|
||||||
interface MessageInterface extends DataInterface, \ArrayAccess, \Countable {
|
interface MessageInterface extends DataInterface, \Traversable, \ArrayAccess, \Countable {
|
||||||
/**
|
/**
|
||||||
* @param FrameInterface $fragment
|
* @param FrameInterface $fragment
|
||||||
* @return MessageInterface
|
* @return MessageInterface
|
||||||
|
@ -64,7 +64,7 @@ class MessageStreamer {
|
|||||||
if ($context->getMessage()->isCoalesced()) {
|
if ($context->getMessage()->isCoalesced()) {
|
||||||
$msgCheck = $this->validator->checkMessage($context->getMessage());
|
$msgCheck = $this->validator->checkMessage($context->getMessage());
|
||||||
if ($msgCheck !== true) {
|
if ($msgCheck !== true) {
|
||||||
$context->onClose($msgCheck || null);
|
$context->onClose($msgCheck);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$context->onMessage($context->getMessage());
|
$context->onMessage($context->getMessage());
|
||||||
|
@ -33,8 +33,11 @@ class ConnectionContext implements Ratchet\RFC6455\Messaging\Streaming\ContextIn
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function onMessage(\Ratchet\RFC6455\Messaging\Protocol\MessageInterface $msg) {
|
public function onMessage(\Ratchet\RFC6455\Messaging\Protocol\MessageInterface $msg) {
|
||||||
$frame = new Frame($msg->getPayload(), true, $msg[0]->getOpcode());
|
foreach ($msg as $frame) {
|
||||||
$this->_conn->write($frame->getContents());
|
$frame->unMaskPayload();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_conn->write($msg->getContents());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onPing(\Ratchet\RFC6455\Messaging\Protocol\FrameInterface $frame) {
|
public function onPing(\Ratchet\RFC6455\Messaging\Protocol\FrameInterface $frame) {
|
||||||
|
Loading…
Reference in New Issue
Block a user