API 参考

Discover (LAN)

发现局域网(LAN/Wi-Fi Aware)上的其他 PlainApp 实例。发现是配对前的第一步——一旦发现设备,在 Pairing 章节调用配对变更。

类型定义

bash
# Discovery uses UDP broadcast on the LAN and (optionally) Wi-Fi Aware.
# Discovered devices are not persisted; call isDiscovering to poll state.
# Use the NearbyViewModel events / WebSocket push channel to receive the
# live list of discovered devices.

操作

mutation

startDiscovery

开始扫描局域网中的 PlainApp peers。立即返回;结果通过 WebSocket 事件通道推送并显示在 Nearby UI 中。

bash
mutation StartDiscovery {
  startDiscovery
}
mutation

stopDiscovery

停止进行中的发现扫描。

bash
mutation StopDiscovery {
  stopDiscovery
}
query

isDiscovering

发现扫描是否正在运行。

bash
query IsDiscovering {
  isDiscovering
}