Closed deathcap closed 8 years ago
^C^[[Awsmc $ ./run.sh
+ java -cp target/wsmc-0.0.1.jar deathcap.wsmc.Main
WS(0.0.0.0:24444) <--> MC(localhost:25565)
Jan 17, 2016 2:34:30 PM deathcap.wsmc.lib.netty.channel.DefaultChannelId defaultProcessId
WARNING: Failed to find the current process ID; using a random value: 52704
Jan 17, 2016 2:34:36 PM deathcap.wsmc.web.WebSocketHandler setupInitialConnection
INFO: Received WS connection: /0:0:0:0:0:0:0:1:63810 --> /0:0:0:0:0:0:0:1:24444
Jan 17, 2016 2:34:36 PM deathcap.wsmc.web.WebSocketHandler setupInitialConnection
INFO: readableBytes = 14
Jan 17, 2016 2:34:36 PM deathcap.wsmc.web.WebSocketHandler setupInitialConnection
INFO: clientCredential = mcwebchatuserX
Jan 17, 2016 2:34:36 PM deathcap.wsmc.web.WebSocketHandler setupInitialConnection
INFO: command-line mode, allowing everyone
Connecting to localhost:25565 as mcwebchatuserX
Connected to localhost/127.0.0.1:25565
wrote handshake packet
opcode = 3
03 80
Compression threshold set to 256
m = UnpooledUnsafeDirectByteBuf(ridx: 0, widx: 3, cap: 3)=03 80 02
mc -> ws: 03 80 02
mcwebchat fails to decode, 256 is not in the mappings value:
function readMapper(buffer, offset, _ref, rootNode) {
var type = _ref.type;
var mappings = _ref.mappings;
var _read = this.read(buffer, offset, type, rootNode);
var size = _read.size;
var value = _read.value;
var results = {
size: size,
value: mappings[value]
};
if (results.value == undefined) throw new Error(value + " is not in the mappings value");
return results;
}
buffer is [128, 2, 0]
, tries to read varint for packet type, gets 256 (varint size 2).
versus wsmc/JS proxy:
compress { threshold: 256 }
mc received 3 bytes
000000 03 80 02 ...
lengthField= <Buffer 03>
writing to ws 4 bytes
000000 03 03 80 02 ....
still have length prepending on mc -> ws. Only remove on ws -> mc?
https://github.com/deathcap/wsmc/pull/21 removed the varint length prefix from the ws-encapsulated mc protocol, but only in the JavaScript version (wsmc.js). The Java proxy should be updated too, or it won't be compatible with new clients.
To close https://github.com/deathcap/wsmc/issues/22