[common] binary message in ws connection

This commit is contained in:
2019-05-23 11:43:35 +03:00
parent 4b426183e8
commit 864d5f3335
9 changed files with 60 additions and 53 deletions

View File

@@ -1,6 +1,5 @@
package ru.m.connect.neko;
import haxe.io.BytesOutput;
import protohx.Message;
import sys.net.Socket;
@@ -19,9 +18,7 @@ class NekoConnection<O:Message, I:Message> extends BaseConnection<O, I> {
private function _send(packet:O):Void {
try {
var b = new BytesOutput();
packet.writeTo(b);
var bytes = b.getBytes();
var bytes = PacketUtil.toBytes(packet);
socket.output.writeUInt16(bytes.length);
socket.output.write(bytes);
socket.output.flush();