# SocketTask

Start from base library version 1.7.0. Please remaining backward compatible.

The WebSocket task can be created and returned via the wx.connectSocket() API.

# Methods

# SocketTask.send(Object object)

Sends data over a WebSocket connection

# SocketTask.close(Object object)

Disables the WebSocket connection

# SocketTask.onOpen(function callback)

Listens on the event of enabling the WebSocket connection.

# SocketTask.onClose(function callback)

Listens on the event of disabling the WebSocket connection.

# SocketTask.onError(function callback)

Listens on the WebSocket error event.

# SocketTask.onMessage(function callback)

Listens on the event of receiving server messages by WebSocket

点击咨询小助手