io.agora.rtm.MessageEvent Maven / Gradle / Ivy
package io.agora.rtm;
import io.agora.common.internal.CalledByNative;
import io.agora.rtm.RtmConstants.RtmChannelType;
import io.agora.rtm.RtmMessage;
public class MessageEvent {
/**
* Which channel type, RTM_CHANNEL_TYPE_STREAM or RTM_CHANNEL_TYPE_MESSAGE
*/
private RtmChannelType channelType;
/**
* The channel which the message was published
*/
private String channelName = "";
/**
* If the channelType is RTM_CHANNEL_TYPE_STREAM, which topic the message came
* from. only for
* RTM_CHANNEL_TYPE_STREAM
*/
private String topicName = "";
/**
* The payload
*/
private RtmMessage message;
/**
* The publisher
*/
private String publisher = "";
/**
* The custom type of the message
*/
private String customType = "";
/**
* Creates a new instance of {@code MessageEvent} with default parameters.
*/
public MessageEvent() {
this.channelType = RtmChannelType.NONE;
this.message = new RtmMessage();
}
@CalledByNative
public MessageEvent(int channelType, String channelName, String topicName, RtmMessage message,
String publisher, String customType) {
this.channelType = RtmChannelType.getEnum(channelType);
this.channelName = channelName;
this.topicName = topicName;
this.message = message;
this.publisher = publisher;
this.customType = customType;
}
public RtmChannelType getChannelType() {
return this.channelType;
}
public String getChannelName() {
return this.channelName;
}
public String getTopicName() {
return this.topicName;
}
public RtmMessage getMessage() {
return this.message;
}
public String getPublisherId() {
return this.publisher;
}
public String getCustomType() {
return this.customType;
}
@Override
public String toString() {
return "MessageEvent {channelType: " + channelType + ", channelName: " + channelName
+ ", topicName: " + topicName + ", message: " + message + ", publisher: " + publisher
+ ", customType: " + customType + "}";
}
}