redux-websocket-middleware icon indicating copy to clipboard operation
redux-websocket-middleware copied to clipboard

This software cannot work,

Open DL1CB opened this issue 7 years ago • 1 comments

in src/index.js

 connection.onmessage(function (data) {
    store.dispatch(createMessageAction(endpoint, data))
  })

connection does not have the function onmessage

should be someting like

 connection.socket.onmessage(function (data) {
    store.dispatch(createMessageAction(endpoint, data))
 })

DL1CB avatar Dec 23 '17 10:12 DL1CB

Yes that doesn't even at all, it needs to be this:

connection.socket.onmessage = function (data) {
        store.dispatch(createMessageAction(endpoint, data))
      }

      connection.socket.onopen = function () {
        store.dispatch(createConnectionAction(endpoint))
      }

      connection.socket.onclose = function () {
        store.dispatch(createDisonnectionAction(endpoint))
      }

      connection.socket.onerror = function (error) {
        store.dispatch(createErrorAction(endpoint, error))
      }

Also, I don't understand these claims:

  • creating and opening the socket
  • retrying the connection when lost, and exponentially backing off
  • batching writes when offline, and sending when available

Was this a TODO? because the released version does not retry connection or do offline batching!

knro avatar Apr 11 '18 10:04 knro