RocketChat / Rocket.Chat.js.SDK

Utility for apps and bots to interact with Rocket.Chat via DDP and/or API
MIT License
136 stars 94 forks source link

[FIX] Use WebSocket close code 4000 for manual disconnection #129

Closed diegolmello closed 3 years ago

diegolmello commented 3 years ago

Instead of using code 1000, which is a Normal Closure, let's use one of the available for application codes (4000-4999). This PR changes it to use 4000 and checks for it directly instead of using 1000 and checking for disconnect reason.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent