Skip to content

UDPSocket.onMessage ​

js
    UDPSocket.onMessage(function callback)

Listens for the message-received event.

Parameters

  • function callback: the callback function for the message-received event

callback parameter description:

Object res:

PropertyTypeDefaultDescription
messageArrayBufferThe received message
remoteInfoObjectSender address information
localInfoObjectReceiver address information

remoteInfo structure:

PropertyTypeDefaultDescription
addressstringThe address of the socket that sent the message
familystringThe protocol family used, either IPv4 or IPv6
portnumberPort number
sizenumberThe size of message, in bytes

localInfo structure:

PropertyTypeDefaultDescription
addressstringThe address of the socket that sent the message
familystringThe protocol family used, either IPv4 or IPv6
portnumberPort number