-
public final class ZeroGpuWebSocketA single device WebSocket session. Instances are single-use: connect once, disconnect once. The owning ai.zerogpu.android.sdk.ZeroGpuSdk creates a fresh instance per (re)connection and drives the foreground/background lifecycle; this class only opens the socket, does the hello handshake, relays tasks, and reports terminal closure via onClosed. The OkHttpClient is shared and owned by the node (so reconnects don't leak thread/connection pools).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classZeroGpuWebSocket.Companion
-
Constructor Summary
Constructors Constructor Description ZeroGpuWebSocket(OkHttpClient client, String wsUrl, String deviceId, String sessionKey, List<SlmConfigStatus> slmConfigs, ErrorReporter errorReporter, EventReporter reporter)
-
Method Summary
Modifier and Type Method Description final Function1<TaskMessage, Unit>getOnTask()Invoked with each inbound task batch. final UnitsetOnTask(Function1<TaskMessage, Unit> onTask)Invoked with each inbound task batch. final Function0<Unit>getOnReady()final UnitsetOnReady(Function0<Unit> onReady)final Function1<Boolean, Unit>getOnClosed()Fired exactly once when the socket terminates. final UnitsetOnClosed(Function1<Boolean, Unit> onClosed)Fired exactly once when the socket terminates. final BooleangetIsReady()final UnitsetIsReady(Boolean isReady)final Unitconnect()final Unitdisconnect(Integer code, String reason)final UnitsendStatus(String status)Client→server status update on the live session. final UnitsendTaskResults(List<TaskResult> results)-
-
Constructor Detail
-
ZeroGpuWebSocket
ZeroGpuWebSocket(OkHttpClient client, String wsUrl, String deviceId, String sessionKey, List<SlmConfigStatus> slmConfigs, ErrorReporter errorReporter, EventReporter reporter)
-
-
Method Detail
-
getOnTask
final Function1<TaskMessage, Unit> getOnTask()
Invoked with each inbound task batch. The host hops to a coroutine scope to run + reply.
-
setOnTask
final Unit setOnTask(Function1<TaskMessage, Unit> onTask)
Invoked with each inbound task batch. The host hops to a coroutine scope to run + reply.
-
getOnReady
final Function0<Unit> getOnReady()
-
setOnReady
final Unit setOnReady(Function0<Unit> onReady)
-
getOnClosed
final Function1<Boolean, Unit> getOnClosed()
Fired exactly once when the socket terminates. deliberate is true when disconnect closed it.
-
setOnClosed
final Unit setOnClosed(Function1<Boolean, Unit> onClosed)
Fired exactly once when the socket terminates. deliberate is true when disconnect closed it.
-
getIsReady
final Boolean getIsReady()
-
setIsReady
final Unit setIsReady(Boolean isReady)
-
disconnect
final Unit disconnect(Integer code, String reason)
-
sendStatus
final Unit sendStatus(String status)
Client→server status update on the live session. The registry's DeviceSession accepts a hello_ack-shaped message from an authenticated socket and flips the device
idle/error— this is the degrade/recover wire contract (no new message type).
-
sendTaskResults
final Unit sendTaskResults(List<TaskResult> results)
-
-
-
-