Nearby discovery
Check app.capabilities for feature support and app.access plus host permissions for authorization. Examples use synthetic values; replace paths, IDs, inputs and filters before calling.
Every 2 seconds the nearby page reads isDiscovering and nearbyDevices in one GraphQL query, refreshes the list, and calls startDiscovery only if scanning is stopped. Closing calls stopDiscovery without coordinating other pages. Scanning stops five minutes after the latest start. BLE scanning is separate.
UDP → 224.0.0.251:5353PTR query
IPv4 multicast, not an IP broadcast: 224.0.0.251:5353. A browses every 5 s; B also announces on startup and every 60 s. PTR answers include SRV, TXT and A. Decoded synthetic DNS records are shown in the popups.
Type Definitions
type Mutation {
acquireMdnsDebugSession(token: String!): Boolean!
releaseMdnsDebugSession(token: String!): Boolean!
startDiscovery: Boolean!
stopDiscovery: Boolean!
}
type Query {
isDiscovering: Boolean!
mdnsState: MdnsState!
nearbyDevices: [NearbyDevice!]!
parsePairingQrCode(code: String!): NearbyDevice
}
enum DeviceType {
COMPUTER
PHONE
TABLET
TV
NAS
OTHER
}
enum DiscoveryMethod {
LAN
BLE
QR
}
scalar Instant
scalar Long
type MdnsActivity {
time: Instant!
event: String!
detail: String!
}
type MdnsPacket {
time: Instant!
direction: MdnsPacketDirection!
srcIp: String!
srcPort: Int!
dstIp: String!
dstPort: Int!
size: Long!
summary: String!
detail: String!
}
enum MdnsPacketDirection {
IN
OUT
}
type MdnsService {
serviceType: String!
instanceName: String!
instanceFqdn: String!
hostname: String!
port: Int!
txtRecords: [String!]!
ips: [String!]!
ip6s: [String!]!
complete: Boolean!
}
type MdnsState {
runtimeId: String!
packetsIn: [MdnsPacket!]!
packetsOut: [MdnsPacket!]!
revision: Long!
running: Boolean!
scanning: Boolean!
services: [MdnsService!]!
activity: [MdnsActivity!]!
}
type NearbyDevice {
id: ID!
name: String!
ips: [String!]!
port: Int!
remoteAccess: Boolean
signaturePublicKey: String!
deviceType: DeviceType!
version: String!
platform: String!
discoveryMethods: [DiscoveryMethod!]!
bestIp: String!
status: PeerStatus!
lastSeen: Instant!
}
enum PeerStatus {
PAIRED
UNPAIRED
CHANNEL
}Operations
acquireMdnsDebugSession
Acquire an mDNS debug session using a caller-owned UUID token. Requires HTTP_SERVER support; release the session when the debug page closes.
mutation acquireMdnsDebugSession($token: String!) {
acquireMdnsDebugSession(token: $token)
}releaseMdnsDebugSession
Release the mDNS debug session with the matching token. Requires HTTP_SERVER support.
mutation releaseMdnsDebugSession($token: String!) {
releaseMdnsDebugSession(token: $token)
}startDiscovery
Start device discovery for five minutes. Calling again resets the five-minute timeout. Active discovery pages restart scanning when they observe that it has stopped.
mutation startDiscovery {
startDiscovery
}stopDiscovery
Stop device discovery immediately for all pages and clients, including scans started by a debug session.
mutation stopDiscovery {
stopDiscovery
}isDiscovering
Whether a discovery scan is currently running.
query isDiscovering {
isDiscovering
}mdnsState
Read the current mDNS discovery status and selected service or packet details.
query mdnsState {
mdnsState { runtimeId revision running scanning }
}nearbyDevices
List currently known nearby devices available for discovery or pairing.
query nearbyDevices {
nearbyDevices { id name ips port remoteAccess signaturePublicKey deviceType version }
}parsePairingQrCode
Decode a pairing code into nearby-device connection information when valid.
query parsePairingQrCode($code: String!) {
parsePairingQrCode(code: $code) { id name ips port remoteAccess signaturePublicKey deviceType version }
}