Announcement: Tencent Cloud Mini Program Platform Renamed to Tencent Cloud Super App as a Service on January 2, 2025
Console Updates
Android SDK Updates
iOS SDK Updates
Flutter SDK Updates
IDE Updates
Base Library Updates
The method of utilizing this API is wx.stopLocalServiceDiscovery(Object object).
Attributes | Types | Default value | Required | Note |
success | function | - | Not required | Callback function for successful interface invocation |
fail | function | - | Not required | Callback function for unsuccessful interface invocation |
complete | function | - | Not required | Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations) |
Attributes | Types | Note |
errMsg | string | Error message, with the valid value being 'task not found': invoked when stopLocalServiceDiscovery is called while not currently in the search service. |
The usage method for this API is wx.startLocalServiceDiscovery(Object object)
Attributes | Types | Default value | Required | Note |
serviceType | string | - | Supported | The type of service to be searched for |
success | function | - | Not required | Callback function for successful interface invocation |
fail | function | - | Not required | Callback function for unsuccessful interface invocation |
complete | function | - | Not required | Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations) |
Attributes | Types | Note |
errMsg | string | Error message, valid values are Invalid parameter: serviceType is empty. Scan task already exists: startLocalServiceDiscovery is called again while the search initiated by the current startLocalServiceDiscovery has not stopped. |
wx.startLocalServiceDiscovery({// There is a service of type _http._tcp. in the local area network connected to the current mobile phone.serviceType: '_http._tcp.',success: console.log,fail: console.log})
The usage method for this API is wx.offLocalServiceResolveFail(function listener).
const listener = function (res) { console.log(res) }wx.onLocalServiceResolveFail(listener)wx.offLocalServiceResolveFail(listener) // The same function object as the listener must be passed in.
The usage method for this API is wx.onLocalServiceResolveFail(function listener).
Attributes | Types | Note |
serviceType | string | Service Type |
serviceName | string | Service Name |
The usage method for this API is wx.offLocalServiceLost(function listener).
const listener = function (res) { console.log(res) }wx.onLocalServiceLost(listener)wx.offLocalServiceLost(listener) // The same function objct as used during listening must be passed in.
The usage method for this API is wx.onLocalServiceLost(function listener).
Attributes | Types | Note |
serviceType | string | Service Type |
serviceName | string | Service Name |
The usage method for this API is wx.offLocalServiceFound(function listener).
const listener = function (res) { console.log(res) }wx.onLocalServiceFound(listener)wx.offLocalServiceFound(listener) // The same function object as the one used during monitoring needs to be passed in.
The usage method for this API is wx.onLocalServiceFound(function listener).
Attributes | Types | Note |
serviceType | string | Service Type |
serviceName | string | Service Name |
ip | string | The IP address of the service. |
port | number | The port of the service. |
The usage method for this API is wx.offLocalServiceDiscoveryStop(function listener).
const listener = function (res) { console.log(res) }wx.onLocalServiceDiscoveryStop(listener)wx.offLocalServiceDiscoveryStop(listener) // The same function object as the listener must be passed in.
The usage method for this API is wx.onLocalServiceDiscoveryStop(function listener).
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback