0.2.0 no longer works for me
Closed this issue · 5 comments
dubiousdavid commented
0.1.0
works great, but 0.2.0
is not reconnecting for me. Here is my logic (uses Kefir FRP):
import WebSocket from 'robust-websocket'
let ws = new WebSocket('wss://echo.websocket.org')
let online$ = Kefir.fromPoll(500, () => navigator.onLine).skipDuplicates()
let socketConnected$ = Kefir.stream(emitter => {
ws.onopen = () => emitter.emit(true)
ws.onclose = () => emitter.emit(false)
})
let connected$ = socketConnected$
.combine(online$, (connected, online) => connected && online)
.toProperty(() => false)
nathanboktae commented
Don't you mean new RobustWebSocket
? Also if you use wss
are you also connecting from a page on |hyyps`?
dubiousdavid commented
Sorry, I updated the code sample. I'm doing an ES6 import earlier in the code.
dubiousdavid commented
Yes, it's connecting from an https
page: https://dubiousdavid.github.io/muv.js/examples/websocket/
nathanboktae commented
That example uses ReconnectingWebSocket not RobustWebSocket. See line 4472.
A vanilla JS example (not babel, not using a framework) would help.
nathanboktae commented
Here's my working codepen of 0.2.0. Reopen if you have more insights.