mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-10-05 00:50:34 -04:00
Add noPacketFramer option to createClientStream()
This commit is contained in:
parent
6125fb7303
commit
73d69e66d7
@ -51,6 +51,7 @@
|
|||||||
"protodef": "0.2.5",
|
"protodef": "0.2.5",
|
||||||
"readable-stream": "^1.1.0",
|
"readable-stream": "^1.1.0",
|
||||||
"superagent": "~0.10.0",
|
"superagent": "~0.10.0",
|
||||||
|
"through": "^2.3.8",
|
||||||
"ursa-purejs": "0.0.3",
|
"ursa-purejs": "0.0.3",
|
||||||
"uuid": "^2.0.1",
|
"uuid": "^2.0.1",
|
||||||
"uuid-1345": "^0.99.6",
|
"uuid-1345": "^0.99.6",
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
var Client = require('./client');
|
var Client = require('./client');
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var states = require("./states");
|
var states = require("./states");
|
||||||
|
var EmptyTransformStream = require('through')();
|
||||||
|
|
||||||
module.exports=createClientStream;
|
module.exports=createClientStream;
|
||||||
|
|
||||||
@ -19,6 +20,12 @@ function createClientStream(options) {
|
|||||||
|
|
||||||
var client = new Client(false,version.majorVersion);
|
var client = new Client(false,version.majorVersion);
|
||||||
|
|
||||||
|
// Options to opt-out of MC protocol packet framing (useful since WS is alreay framed)
|
||||||
|
// TODO: refactor
|
||||||
|
if (options.noPacketFramer) {
|
||||||
|
client.framer = EmptyTransformStream;
|
||||||
|
}
|
||||||
|
|
||||||
if(keepAlive) client.on('keep_alive', onKeepAlive);
|
if(keepAlive) client.on('keep_alive', onKeepAlive);
|
||||||
client.once('success', onLogin);
|
client.once('success', onLogin);
|
||||||
client.once("compress", onCompressionRequest);
|
client.once("compress", onCompressionRequest);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user