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