I have this code from the internet but pretty quickly the websocket closes and I have no idea why. It seems like the _reconnect function is not properly called but as I am not e