diff --git a/lib/src/core/room.dart b/lib/src/core/room.dart index ff67acb..7f6e61a 100644 --- a/lib/src/core/room.dart +++ b/lib/src/core/room.dart @@ -550,6 +550,7 @@ class Room extends DisposableChangeNotifier with EventsEmittable { final event = DataReceivedEvent( participant: senderParticipant, data: dataPacketEvent.packet.payload, + topic: dataPacketEvent.packet.topic, ); senderParticipant?.events.emit(event); diff --git a/lib/src/events.dart b/lib/src/events.dart index 39ee71d..958c277 100644 --- a/lib/src/events.dart +++ b/lib/src/events.dart @@ -347,9 +347,11 @@ class DataReceivedEvent with RoomEvent, ParticipantEvent { /// Sender of the data. This may be null if data is sent from Server API. final RemoteParticipant? participant; final List data; + final String? topic; const DataReceivedEvent({ required this.participant, required this.data, + required this.topic, }); @override diff --git a/lib/src/participant/local.dart b/lib/src/participant/local.dart index acdc76f..bb512f0 100644 --- a/lib/src/participant/local.dart +++ b/lib/src/participant/local.dart @@ -256,10 +256,12 @@ class LocalParticipant extends Participant { /// Publish a new data payload to the room. /// @param destinationSids When empty, data will be forwarded to each participant in the room. + /// @param topic, the topic under which the message gets published. Future publishData( List data, { Reliability reliability = Reliability.reliable, List? destinationSids, + String? topic, }) async { final packet = lk_models.DataPacket( kind: reliability.toPBType(), @@ -267,6 +269,7 @@ class LocalParticipant extends Participant { payload: data, participantSid: sid, destinationSids: destinationSids, + topic: topic, ), );