Closed beoArcha closed 4 years ago
I am using reconnecting-websocket to connect react app to sever. When I reconnect after losing connection, offen is needed to send different message. I need to do is as fast as possible, but it's not working as expected.
Demo code for problem demonstartion:
value = "oldValue"; webSocket = new ReconnectingWebSocket("ws://localhost/socket"); handler = () => console.log(this.value) handleDidMount = () => { webSocket.addEventListener("open", this.handler); this.value - "newValue"; console.log("reconnect") webSocket.reconnect() }
My expected console result is: oldValue reconnect newValue
However I get: oldValue reconnect oldValue
my problem is how to get expected result?
I am using reconnecting-websocket to connect react app to sever. When I reconnect after losing connection, offen is needed to send different message. I need to do is as fast as possible, but it's not working as expected.
Demo code for problem demonstartion:
My expected console result is: oldValue reconnect newValue
However I get: oldValue reconnect oldValue
my problem is how to get expected result?