Adding reconnect logic to WebSockets.