# UDPSocket.onMessage(function callback)

with Promise style call: Not supported

Mini Program plugin: Support, need to Mini Program base library version no less than 2.11.1

Listen to events that receive messages

# parameter

# function callback

Callback function for events that receive messages

# parameter

# Object res
attribute type Introductions
message ArrayBuffer Message received
remoteInfo Object Sender Address Information
localInfo Object Receiver Address Information, 2.18.0 Rise support

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