onMessageReceived method

void onMessageReceived(
  1. DataPackage pkt
)

Implementation

void onMessageReceived(DataPackage pkt) async
{
    final cData = ChannelData<T>(
        _mutator.getter(pkt),
        DateTime.fromMillisecondsSinceEpoch(pkt.unixTimestampMs.toInt()),
        pkt.sourceUserToken,
    );
    print("on message received");

    if (_callback != null)
    {
        await _callback!(cData);
    }

}