Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

648 B
Raw Blame
package events

// UserMessageEvent is an inbound message from a user.
type UserMessageEvent struct {
	Event
	UserEvent
	MessageEvent
}

// GetBroadcastPayload will return the object to send to all chat users.
func (e *UserMessageEvent) GetBroadcastPayload() EventPayload {
	return EventPayload{
		"id":                e.ID,
		payloadKeyTimestamp: e.Timestamp,
		payloadKeyBody:      e.Body,
		payloadKeyUser:      e.User,
		payloadKeyType:      MessageSent,
		"visible":           e.HiddenAt == nil,
	}
}

// GetMessageType will return the event type for this message.
func (e *UserMessageEvent) GetMessageType() EventType {
	return MessageSent
}