appuri/robust-websocket

0.2.0 no longer works for me

Closed this issue · 5 comments

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)

Don't you mean new RobustWebSocket? Also if you use wss are you also connecting from a page on |hyyps`?

Sorry, I updated the code sample. I'm doing an ES6 import earlier in the code.

That example uses ReconnectingWebSocket not RobustWebSocket. See line 4472.

A vanilla JS example (not babel, not using a framework) would help.

Here's my working codepen of 0.2.0. Reopen if you have more insights.