Reverted old code

main
Tiger 2024-02-17 21:32:15 +01:00
parent d5efddd10d
commit 6b0d439f7c
1 changed files with 5 additions and 6 deletions

View File

@ -17,12 +17,11 @@ readonly class Session {
} }
public function sendComposer(IMessageComposer $composer): void { public function sendComposer(IMessageComposer $composer): void {
$headerData = pack('n', 2491); $message = new ServerMessage($composer->getHeader()->value);
$length = strlen($headerData); $composer->compose($message);
$lengthData = pack('N', $length); $data = array_merge(ByteEncoding::int32ToArray(count($message->getPacket())), $message->getPacket());
$binaryMessage = $lengthData . $headerData;
$frame = new Frame($binaryMessage, true, Frame::OP_BINARY); $this->connection->send(new Frame(pack('C*', ...$data), true, Frame::OP_BINARY));
$this->connection->send($frame);
} }
function encode($text) { function encode($text) {