Interface TaskChannel
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
WsConnection.TaskHandle,WsSession
One task's view over a WebSocket (audio design §3): implemented by
WsSession (dedicated
socket) and by WsConnection.TaskHandle (a demultiplexed task on a shared socket). Sends
are lock-protected; recv(java.time.Duration) blocks on the caller's thread — the SDK starts no per-task
callback thread (pull model; users run one send thread + one receive thread).-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Idempotent.Next inbound item for this task, blocking up totimeout;nullon timeout.voidsendBinary(ByteBuffer data) Send a raw binary frame (no header; ownership rules apply on shared connections).voidSend a text frame (already-serialized JSON).taskId()
-
Method Details
-
taskId
String taskId() -
sendText
Send a text frame (already-serialized JSON). Full upstream queue → SdkException. -
sendBinary
Send a raw binary frame (no header; ownership rules apply on shared connections). -
recv
Next inbound item for this task, blocking up totimeout;nullon timeout. FAILURE events throw their carried exception. -
close
void close()Idempotent. On a shared connection this detaches the task only; if the task owns a binary lane and has not reached its terminal event, the whole shared connection is torn down instead (binary frames carry no task id, so the lane cannot be handed over safely). A local close is surfaced to a blockedrecv(java.time.Duration)as aLOCAL_CLOSEDevent; a binary-owner teardown is surfaced to every unfinished task, including the closer, as a terminal event instead (a thrown failure — orCLOSEDif the peer closed the connection concurrently).- Specified by:
closein interfaceAutoCloseable
-