Comparing version
@@ -77,14 +77,11 @@ /* jshint esversion: 6 */ | ||
send(message, options, cb) { | ||
send(message, options, cb) { // options will be ignored | ||
if (this.external) { | ||
const binary = (typeof message !== 'string'); | ||
if (typeof options === 'function') { | ||
cb = options; | ||
options = null; | ||
} | ||
const binary = options && typeof options.binary === 'boolean' ? options.binary : typeof message !== 'string'; | ||
native.server.send(this.external, message, binary ? eiows.OPCODE_BINARY : eiows.OPCODE_TEXT, cb ? (() => { | ||
process.nextTick(cb); | ||
}) : undefined, options && options.compress); | ||
}) : undefined); | ||
} else if (cb) { | ||
@@ -110,5 +107,8 @@ cb(new Error('not opened')); | ||
var nativeOptions = 0; | ||
var compressThreshold = 0; | ||
if (options.perMessageDeflate !== undefined && options.perMessageDeflate !== false) { | ||
nativeOptions |= eiows.PERMESSAGE_DEFLATE; | ||
if (!isNaN(options.perMessageDeflate.threshold)) { | ||
compressThreshold = Math.max(compressThreshold, options.perMessageDeflate.threshold); | ||
} | ||
if (options.perMessageDeflate.serverNoContextTakeover === false) { | ||
@@ -119,3 +119,3 @@ nativeOptions |= eiows.SLIDING_DEFLATE_WINDOW; | ||
this.serverGroup = native.server.group.create(nativeOptions, options.maxPayload === undefined ? DEFAULT_PAYLOAD_LIMIT : options.maxPayload); | ||
this.serverGroup = native.server.group.create(nativeOptions, compressThreshold, options.maxPayload === undefined ? DEFAULT_PAYLOAD_LIMIT : options.maxPayload); | ||
@@ -122,0 +122,0 @@ this._upgradeCallback = noop; |
{ | ||
"name": "eiows", | ||
"version": "7.1.2", | ||
"version": "8.0.0", | ||
"description": "custom fork of uWebSockets 0.14", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
107143
0.65%169
1.81%