mindspank / qsocks

A lightweight promise wrapper around the Qlik Sense Engine API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

not properly setting IS_NODE parameter

skokenes opened this issue · comments

I have a library that uses qsocks as a dependency. I am trying to run my library server side with Node. I call a connect function on my service, which internally makes a connect call on qsocks.

I am getting errors that WebSocket is not a function from qsocks. I checked what was happening and noticed that "IS_NODE" is being set to false. The current "IS_NODE" determiner is
var IS_NODE = typeof process !== "undefined" && Object.prototype.toString.call(process) === "[object process]";

However, I am seeing the following values when I debug qsocks when it is called from my library:

typeof process -> object
Object.prototype.toString.call(process) -> [object Object]

This is flagging "IS_NODE" as false. Is this expected behavior? How do I work around this?

addressed with #33, which was merged