Skip to main content
Version: 0.1.x

PubSub Class Methods

publish()

  • publish() is used to publish messages on a specified topic in the meeting.

Parameters

  • topic

    • type: String
    • This is the name of the topic, for which message will be published.
  • message

    • type: String
    • This is the actual message.
  • options

Returns

  • void

Example

// Publish message for 'CHAT' topic
val publishOptions = PubSubPublishOptions()
publishOptions.isPersist = true

meeting!!.pubSub.publish("CHAT", "Hello from Android", publishOptions)

subscribe()

  • subscribe() is used to subscribe a particular topic to get all the messages of that particular topic in the meeting.

Parameters

  • topic:

    • type: String
    • Participants can listen to messages on that particular topic.
  • listener:

Returns

Example

var pubSubMessageListener: ubSubMessageListener =
PubSubMessageListener { message ->
Log.d("#message","onMessageReceived: " + message.message)
}

// Subscribe for 'CHAT' topic
val pubSubMessageList = meeting!!.pubSub.subscribe("CHAT", pubSubMessageListener)

unsubscribe()

  • unsubscribe() is used to unsubscribe a particular topic on which you have subscribed priviously.

Parameters

Returns

  • void

Example

// Unsubscribe for 'CHAT' topic
meeting!!.pubSub.unsubscribe("CHAT", pubSubMessageListener)