# Free, bundled Mobiler plugin: WebSocket (persistent real-time connection). Rides the streaming
# primitive — `subscribe` opens the socket and streams frames into `update`; call from Rust:
# cx.subscribe("ws", "websocket", "stream", "wss://echo.websocket.org", |r| Msg::Frame(r))
# cx.plugin("websocket", "send", "hello", |_| Msg::Noop) // send while subscribed
# cx.unsubscribe("ws") // closes the socket
# (Legacy request/response ops connect/recv/close remain for back-compat.)
#
# Install: mobiler plugin add websocket
# Android = OkHttp WebSocket (already a shell dep); iOS = URLSessionWebSocketTask (system framework).
= "websocket"
= "WebSocket — persistent real-time connection, streaming (free)"
[]
= ["android/WebSocketPlugin.kt"]
= '"websocket" to WebSocketPlugin(application)'
# Streaming is the plugin's `subscribe()` override (polymorphic), so no separate registration line.
# OkHttp is already a template dependency (HttpPlugin), so no extra gradle_deps needed.
[]
= ["ios/WebSocketPlugin.swift"]
= 'case "websocket": return await WebSocketPlugin.handle(op: op, input: input)'
= 'case "websocket": await WebSocketPlugin.subscribe(op: op, input: input, emit: emit)'