Skip to main content
Version: 3.x.x

Properties - Android

A PubSubMessage is one message delivered to a PubSubMessageListener. Read its fields as Kotlin properties. All of them except timestamp are nullable, so handle null when you read them:

val text = message.message ?: ""
val isMine = message.senderId == room.localParticipant.id

id​

  • type: String?

  • id is the unique id of the pubsub message.


message​

  • type: String?

  • message is the message that has been published on the specific topic.


topic​

  • type: String?

  • topic is the name of the message topic.


senderId​

  • type: String?

  • senderId is the id of the participant who has sent the message. Compare it with room.localParticipant.id to tell your own messages from everyone else's.


senderName​

  • type: String?

  • senderName is the name of the participant who has sent the pubsub message.


timestamp​

  • type: String

  • timestamp is the time at which the server accepted the pubsub message, exactly as the server sent it: an ISO-8601 UTC string such as 2026-10-05T09:30:00.000Z. It is an empty string if the server sent none.

  • To get a time value, parse it, for example with java.time.Instant.parse(message.timestamp) (API level 26 and above). Check for an empty string first.


payload​

  • type: JSONObject?

  • payload is the data sent along with the message, or null if none was sent.

Got a Question? Ask us on discord