Atmosphere / atmosphere-javascript

atmosphere-javascript
Apache License 2.0
122 stars 98 forks source link

Error: "message is not defined" #266

Closed nicubularda closed 3 years ago

nicubularda commented 3 years ago

If setting logLevel to "warn" when the Websocket reconnect maximum try was reached you will get into the "message is not defined" error.

jfarcand commented 3 years ago

@nicubularda can you share the complete stack trace, and also the version used?

tkohlman commented 3 years ago

I see this issue in version 3.0.6 when I set maxReconnectOnClose: 0 and then kill the server.

Uncaught ReferenceError: message is not defined at _reconnectWebSocket (atmosphere.js:1747) at WebSocket._websocket.onclose (atmosphere.js:1564)

ivan-lattak commented 3 years ago

Seems to be caused by line atmosphere-3.0.6.js:1749 atmosphere.util.warn("Websocket error, reason: " + message.reason); This code was probably moved here from somewhere else. The message variable is not defined in this scope.

jfarcand commented 3 years ago

@ivan-lattak Can you do a pull request? I will merge and release. Thanks

fcorneli commented 3 years ago

I also stumbled upon the same javascript warning when shutting down the server. Caused at: https://github.com/Atmosphere/atmosphere-javascript/blob/2aeccb6c6afece69c664c95c7e66b3693ab8ec26/modules/javascript/src/main/webapp/javascript/atmosphere.js#L1751

fcorneli commented 3 years ago

Hence in 3.1.0 we have the same issue.