2023-01-11 06:38:48 +00:00
|
|
|
package barertc
|
|
|
|
|
|
|
|
type Message struct {
|
|
|
|
Action string `json:"action,omitempty"`
|
|
|
|
Username string `json:"username"`
|
|
|
|
Message string `json:"message"`
|
2023-01-27 04:34:58 +00:00
|
|
|
|
|
|
|
// WhoList for `who` actions
|
|
|
|
WhoList []WhoList `json:"whoList"`
|
|
|
|
|
|
|
|
// Sent on `me` actions along with Username
|
|
|
|
VideoActive bool `json:"videoActive"` // user tells us their cam status
|
2023-01-11 06:38:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const (
|
2023-01-27 04:34:58 +00:00
|
|
|
// Actions sent by the client side only
|
|
|
|
ActionLogin = "login" // post the username to backend
|
|
|
|
|
|
|
|
// Actions sent by server or client
|
2023-01-11 06:38:48 +00:00
|
|
|
ActionMessage = "message" // post a message to the room
|
2023-01-27 04:34:58 +00:00
|
|
|
ActionMe = "me" // user self-info sent by FE or BE
|
|
|
|
|
|
|
|
// Actions sent by server only
|
|
|
|
ActionWhoList = "who" // server pushes the Who List
|
|
|
|
ActionPresence = "presence" // a user joined or left the room
|
2023-01-11 06:38:48 +00:00
|
|
|
)
|
2023-01-27 04:34:58 +00:00
|
|
|
|
|
|
|
// WhoList is a member entry in the chat room.
|
|
|
|
type WhoList struct {
|
|
|
|
Username string `json:"username"`
|
|
|
|
VideoActive bool `json:"videoActive"`
|
|
|
|
}
|