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
}