Updated server code to fix intitial issues with WebSocket connections.