Comparing version 5.5.5 to 5.5.6
@@ -30,5 +30,2 @@ "use strict"; | ||
const options = opts; | ||
if (!opts.hostname) { | ||
options.hostname = 'localhost'; | ||
} | ||
if (!opts.port) { | ||
@@ -112,2 +109,3 @@ if (opts.protocol === 'wss') { | ||
const options = setDefaultOpts(opts); | ||
options.hostname = options.hostname || options.host || 'localhost'; | ||
const url = buildUrl(options, client); | ||
@@ -114,0 +112,0 @@ const socket = createWebSocket(client, url, options); |
@@ -25,3 +25,3 @@ "use strict"; | ||
client.pingResp = Date.now(); | ||
if (packet.cmd !== 'pingresp') { | ||
if (!['pingresp', 'publish'].includes(packet.cmd)) { | ||
client['_shiftPingInterval'](); | ||
@@ -28,0 +28,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isReactNativeBrowser = exports.isWebWorker = void 0; | ||
const isStandardBrowserEnv = () => typeof window !== 'undefined' && typeof window.document !== 'undefined'; | ||
const isStandardBrowserEnv = () => { | ||
var _a; | ||
if (typeof window !== 'undefined') { | ||
const electronRenderCheck = ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.userAgent) === null || _a === void 0 ? void 0 : _a.toLowerCase().indexOf(' electron/')) > -1; | ||
if (electronRenderCheck && (process === null || process === void 0 ? void 0 : process.versions)) { | ||
const electronMainCheck = Object.prototype.hasOwnProperty.call(process.versions, 'electron'); | ||
return !electronMainCheck; | ||
} | ||
return typeof window.document !== 'undefined'; | ||
} | ||
return false; | ||
}; | ||
const isWebWorkerEnv = () => { | ||
@@ -6,0 +17,0 @@ var _a, _b; |
{ | ||
"name": "mqtt", | ||
"description": "A library for the MQTT protocol", | ||
"version": "5.5.5", | ||
"version": "5.5.6", | ||
"contributors": [ | ||
@@ -6,0 +6,0 @@ "Adam Rudd <adamvrr@gmail.com>", |
@@ -5,3 +5,2 @@ import { StreamBuilder } from '../shared' | ||
import _debug from 'debug' | ||
import { Duplex } from 'readable-stream' | ||
@@ -8,0 +7,0 @@ const debug = _debug('mqttjs:tcp') |
@@ -31,5 +31,3 @@ import { StreamBuilder } from '../shared' | ||
const options = opts | ||
if (!opts.hostname) { | ||
options.hostname = 'localhost' | ||
} | ||
if (!opts.port) { | ||
@@ -42,2 +40,3 @@ if (opts.protocol === 'wss') { | ||
} | ||
if (!opts.path) { | ||
@@ -146,2 +145,5 @@ options.path = '/' | ||
const options = setDefaultOpts(opts) | ||
options.hostname = options.hostname || options.host || 'localhost' | ||
const url = buildUrl(options, client) | ||
@@ -148,0 +150,0 @@ const socket = createWebSocket(client, url, options) |
@@ -29,3 +29,3 @@ import handlePublish from './publish' | ||
// do not shift on pingresp otherwise we would skip the pingreq sending | ||
if (packet.cmd !== 'pingresp') { | ||
if (!['pingresp', 'publish'].includes(packet.cmd)) { | ||
client['_shiftPingInterval']() | ||
@@ -32,0 +32,0 @@ } |
@@ -1,3 +0,26 @@ | ||
const isStandardBrowserEnv = () => | ||
typeof window !== 'undefined' && typeof window.document !== 'undefined' | ||
const isStandardBrowserEnv = () => { | ||
// window is only defined when it is a browser | ||
if (typeof window !== 'undefined') { | ||
// Is the process an electron application | ||
// check if we are in electron `renderer` | ||
const electronRenderCheck = | ||
navigator?.userAgent?.toLowerCase().indexOf(' electron/') > -1 | ||
if (electronRenderCheck && process?.versions) { | ||
const electronMainCheck = Object.prototype.hasOwnProperty.call( | ||
process.versions, | ||
'electron', | ||
) | ||
// Both electron checks are only true if the following webPreferences are set in the main electron BrowserWindow() | ||
// webPreferences: { | ||
// sandbox: false, | ||
// nodeIntegration: true | ||
// contextIsolation: false | ||
// } | ||
return !electronMainCheck | ||
} | ||
return typeof window.document !== 'undefined' | ||
} | ||
// return false if nothing is detected | ||
return false | ||
} | ||
@@ -4,0 +27,0 @@ const isWebWorkerEnv = () => |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1843333
32169