setCallbackReceivedMessageForDevice method
void
setCallbackReceivedMessageForDevice(})
Sets callbackReceivedMessage callback for a given device that executes every time a message is received from that device.
Implementation
void setCallbackReceivedMessageForDevice(
String endpointId, Function(Device) callbackReceivedMessage,
{String callbackName = "ConnectionsManager:receivedMessageForDevice"}) {
Device? device = _findDevice(connectedDevices, endpointId);
if (device == null) {
logger.e(
"Could not set callback for received message because device $endpointId is neither connected nor active");
return;
}
device.setCallbackReceivedMessage(callbackName, callbackReceivedMessage);
}