onAdvertisement method

void onAdvertisement (
  1. Device device,
  2. Packet packet
)

This method is called when the Server sends a custom advertisement message. or an unreliable broadcast message using Server.broadcast()

The message received from the device is contained in packet

Please note that you may not be able to send a message directly to the Device received here. Messages can mostly only be sent to Devices received after an event is received from ConnectionListener.onConnected which is triggered when a Client uses Client.connectTo to initiate a connection

Implementation

void onAdvertisement(Device device, Packet packet);