onMessage method
override
Implementation
@override
void onMessage(Uint8List data, [Channel channel = kAnyChannel]) {
super.onMessage(data);
final packet = decode(data);
final receiver = packet.channel;
final newPacket = packet.withChannel(channel);
if (validate &&
!isValidCall(newPacket.function, receiver, newPacket.channel)) {
return;
}
if (!(filter?.call(newPacket, receiver) ?? false)) {
return;
}
if (newPacket.channel == kAuthorityChannel) {
runFunction(newPacket);
return;
}
sendMessage(newPacket);
}