redux-websocket-middleware
redux-websocket-middleware copied to clipboard
This software cannot work,
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))
})
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!