Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: window is undefined #129

Merged
merged 2 commits into from
Jul 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function WebSocketStream(target, protocols, options) {
}

// was already open when passed in
if (socket.readyState === WS.OPEN) {
if (socket.readyState === socket.OPEN) {
stream = proxy
} else {
stream = duplexify.obj()
Expand All @@ -103,7 +103,7 @@ function WebSocketStream(target, protocols, options) {
function socketWriteNode(chunk, enc, next) {
// avoid errors, this never happens unless
// destroy() is called
if (socket.readyState !== WS.OPEN) {
if (socket.readyState !== socket.OPEN) {
next()
return
}
Expand Down
8 changes: 4 additions & 4 deletions ws-fallback.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
var ws = null

if (typeof WebSocket !== 'undefined') {
ws = WebSocket
ws = WebSocket
} else if (typeof MozWebSocket !== 'undefined') {
ws = MozWebSocket
} else {
ws = window.WebSocket || window.MozWebSocket
ws = MozWebSocket
} else if (typeof window !== 'undefined') {
ws = window.WebSocket || window.MozWebSocket
}

module.exports = ws