May 18, 2021 WeChat Mini Program Development Document
Base library 2.4.0 starts to support, and low versions need to be compatible.
Stop searching for mDNS services
Property | Type | The default | Required | Description |
---|---|---|---|---|
success | function | Whether | The interface calls a successful callback function | |
fail | function | Whether | The interface calls the failed callback function | |
complete | function | Whether | Callback function at end of interface call (call succeeds, fails are executed) |
Property | Type | Description |
---|---|---|
errMsg | string | The error message |
The legal value of res.err Msg
Value | Description | The lowest version |
---|---|---|
task not found | StopLocalServiceDiscovery is not currently in the search service |
Base library 2.4.0 starts to support, and low versions need to be compatible.
Start searching for mDNS services under your local area network. The results of the search are returned via the wx.onLocalService event.
Property | Type | The default | Required | Description |
---|---|---|---|---|
serviceType | string | Is | The type of service to search for | |
success | function | Whether | The interface calls a successful callback function | |
fail | function | Whether | The interface calls the failed callback function | |
complete | function | Whether | Callback function at end of interface call (call succeeds, fails are executed) |
Property | Type | Description |
---|---|---|
errMsg | string | The error message |
The legal value of res.err Msg
Value | Description | The lowest version |
---|---|---|
invalid param | ServiceType is empty | |
scan task already exist | Call startLocalServiceDiscovery again if the search initiated by the current startLocalServiceDiscovery does not stop |
wx.startLocalServiceDiscovery({
// 当前手机所连的局域网下有一个 _http._tcp. 类型的服务
serviceType: '_http._tcp.',
success: console.log,
fail: console.log
})
Base library 2.4.0 starts to support, and low versions need to be compatible.
Listen for events that fail to be resolved by the mDNS service
The callback function for the mDNS service to resolve failed events
Property | Type | Description |
---|---|---|
serviceType | string | The type of service |
serviceName | string | The name of the service |
Base library 2.4.0 starts to support, and low versions need to be compatible.
Listens for events that the mDNS service leaves
The callback function for the event that the mDNS service leaves
Property | Type | Description |
---|---|---|
serviceType | string | The type of service |
serviceName | string | The name of the service |
Base library 2.4.0 starts to support, and low versions need to be compatible.
Listen for events discovered by the mDNS service
The callback function for events discovered by the mDNS service
Property | Type | Description |
---|---|---|
serviceType | string | The type of service |
serviceName | string | The name of the service |
Ip | string | The ip address of the service |
port | number | The port of the service |
Base library 2.4.0 starts to support, and low versions need to be compatible.
Listen for events when the mDNS service stops searching
The callback function for events that the mDNS service stops searching for
Base library 2.4.0 starts to support, and low versions need to be compatible.
Cancel listening to the mDNS service to resolve the failed event
The callback function for the mDNS service to resolve failed events
Base library 2.4.0 starts to support, and low versions need to be compatible.
Cancel the event that the mDNS service left
The callback function for the event that the mDNS service leaves
Base library 2.4.0 starts to support, and low versions need to be compatible.
Cancel the events discovered by the mDNS service
The callback function for events discovered by the mDNS service
Base library 2.4.0 starts to support, and low versions need to be compatible.
Cancel the event that the mDNS service stopped the search
The callback function for events that the mDNS service stops searching for