# 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. |
The translations are provided by WeChat Translation and are for reference only. In case of any inconsistency and discrepancy between the Chinese version and the English version, the Chinese version shall prevail.Incorrect translation. Tap to report.