How can I use Gradio websocket API

I make a Android App with JAVA. I can’t use the Python or JS Gradio API.
Then, I have called Gradio API with REST. It is work ok if process (file) is short time. But It will disconnect if HTTP timeout when processing big file.
Then, I try to use the websocket API(undocument) to connect the Gradio ,
I refer the link .
It looks work a few days, But it will fail alway after some days.
I look the error in spaces’s logs. It will occur when the websocket start to connect, before send any message. I wonder why the server block the connecting? Do I lost some operation?
Then , I have use different Android websocket library (AndroidAsync or autobahn-java]) to check it , It looks like the server issue.
I want konw anyone meeting the issue?

ERROR: Exception in ASGI application
Traceback (most recent call last):
File “/home/user/.local/lib/python3.10/site-packages/uvicorn/protocols/websockets/”, line 254, in run_asgi
result = await, self.asgi_receive, self.asgi_send)
File “/home/user/.local/lib/python3.10/site-packages/uvicorn/middleware/”, line 78, in call
return await, receive, send)
File “/home/user/.local/lib/python3.10/site-packages/fastapi/”, line 282, in call
await super().call(scope, receive, send)
File “/home/user/.local/lib/python3.10/site-packages/starlette/”, line 122, in call
await self.middleware_stack(scope, receive, send)
File “/home/user/.local/lib/python3.10/site-packages/starlette/middleware/”, line 149, in call
await, receive, send)
File “/home/user/.local/lib/python3.10/site-packages/starlette/middleware/”, line 75, in call
await, receive, send)
File “/home/user/.local/lib/python3.10/site-packages/starlette/middleware/”, line 79, in call
raise exc
File “/home/user/.local/lib/python3.10/site-packages/starlette/middleware/”, line 68, in call
await, receive, sender)
File “/home/user/.local/lib/python3.10/site-packages/fastapi/middleware/”, line 20, in call
raise e
File “/home/user/.local/lib/python3.10/site-packages/fastapi/middleware/”, line 17, in call
await, receive, send)
File “/home/user/.local/lib/python3.10/site-packages/starlette/”, line 718, in call
await route.handle(scope, receive, send)
File “/home/user/.local/lib/python3.10/site-packages/starlette/”, line 341, in handle
await, receive, send)
File “/home/user/.local/lib/python3.10/site-packages/starlette/”, line 82, in app
await func(session)
File “/home/user/.local/lib/python3.10/site-packages/fastapi/”, line 292, in app
File “/home/user/.local/lib/python3.10/site-packages/gradio/”, line 421, in join_queue
session_info = await websocket.receive_json()
File “/home/user/.local/lib/python3.10/site-packages/starlette/”, line 133, in receive_json
File “/home/user/.local/lib/python3.10/site-packages/starlette/”, line 105, in _raise_on_disconnect
raise WebSocketDisconnect(message[“code”])
starlette.websockets.WebSocketDisconnect: 1006