Fixing memory leak while using websockets.