# wx.onSocketMessage(function callback)
with Promise style call: Not supported
Mini Program plugin: Not supported
to monitor WebSocket Receive a message event to the server.Recommended use SocketTask The way to manage webSocket Link, the life cycle of each link is more controllable. There are multiple simultaneous webSocket In the case of links to wx Prefixes may bring up some of the situations that are not expected.
# parameter
# function callback
WebSocket Callback function to receive message events from the server
# parameter
# Object res
attribute | type | Introductions |
---|---|---|
data | string/ArrayBuffer | Message returned by the server |