Skip to content

Commit a626924

Browse files
committed
client: check the global variable exists
Closes #369
1 parent 98ce79f commit a626924

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/client.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ var eventEmitter = require("./events").EventEmitter;
44
var logger = require("./logger");
55
var parse = require("./parser");
66
var timer = require("./timer");
7-
var ws = global.WebSocket || global.MozWebSocket || require("ws");
7+
var _global = typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : {};
8+
var ws = _global.WebSocket || require("ws");
89
var _ = require("./utils");
910

1011
// Client instance..

0 commit comments

Comments
 (0)