# wx.onSocketClose(function callback)

with Promise style call: Not supported

Mini Program plugin: Not supported

to monitor WebSocket Connection closure event.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 for connection closure event

# parameter

# Object res
attribute type Introductions
code number A numeric value represents the status number for which the connection was closed and indicates why the connection is closed.
reason string A human-readable string representing the reason the connection was closed.