Also, if we want to enable reconnection even in this scenario, what would be the best approach? From what I can see in the code, it seems like the only option is to recreate the entire Socket.
Afaik this is to give the server the option to tell the client to stop reconnecting. E.g. consider a client failing to authenticate. Retrying will never fix that.
Even though the Elixir server does not return 1000, it seems that disconnections with a 1000 status occur (it’s unclear which layer is causing this—whether it’s the communication path, OS, or browser). In such cases, automatic reconnection does not occur, which is causing us trouble.