# SocketTask.onClose(function callback)

with Promise style call: Not supported

Mini Program plugin: Support

to monitor WebSocket Connection Closure Event

# 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.