code: def test_send_recv_text_and_binary(serve_instance, route_prefix: str):
      app = FastAPI()
  
      @serve.deployment
      @serve.ingress(app)
      class WebSocketServer:
          @app.websocket("/")
          async def ws_handler(self, ws: WebSocket):
              await ws.accept()
  
              text = await ws.receive_text()
              await ws.send_text(text)
  
              bytes = await ws.receive_bytes()
              await ws.send_bytes(bytes)
  
      if route_prefix is not None:
          WebSocketServer = WebSocketServer.options(
              route_prefix=route_prefix
          )
  
      serve.run(WebSocketServer.bind())
  
      msg = "Hello world!"
      if route_prefix:
          url = f"ws://localhost:8000{route_prefix}/"
      else:
          url = "ws://localhost:8000/"
      with connect(url) as websocket:
          websocket.send(msg)
          assert websocket.recv() == msg
  
          websocket.send(msg.encode("utf-8"))
          assert websocket.recv().decode("utf-8") == msg
  
file_path: ray/python/ray/serve/tests/test_websockets.py
imports: import asyncio
  import sys
  import pytest
  import requests
  from fastapi import FastAPI, WebSocket, WebSocketDisconnect
  from starlette.responses import StreamingResponse
  from websockets.exceptions import ConnectionClosed
  from websockets.sync.client import connect
  from ray import serve
label_desc: Use image node_id 1 for calling a global function with example usage: test_send_recv_text_and_binary(serve_instance, route_prefix) without return types