# TCPSocket.onMessage(function callback)
with Promise style call: Not supported
Mini Program plugin: Not supported
Monitor triggers the event when data is received
# parameter
# function callback
The callback function that triggers the event when data is received
# parameter
# Object res
attribute | type | Introductions |
---|---|---|
message | ArrayBuffer | Message received |
remoteInfo | Object | Sender Address Information |
localInfo | Object | Receiver address information |
remoteInfo Structure
attribute | type | Introductions |
---|---|---|
address | string | Sending message socket Address |
family | string | The protocol family used by the IPv4 or IPv6 |
port | number | Port number |
size | number | message Size in bytes |
localInfo Structure
attribute | type | Introductions |
---|---|---|
address | string | Receive message socket Address |
family | string | The protocol family used by the IPv4 or IPv6 |
port | number | Port number |