BareRTC/pkg/messages.go
Noah Petherbridge 4f93c27651 Progress on Chat Server
* Reworked full screen CSS layout for the chat.html, still using Bulma
  components with some custom CSS Grid.
* Duplicate username handling: server can push a new username to change
  the client's selection.
* Who List sync between clients.
* Local video casting works so far - plays back your camera in the local
  feed. Your video broadcasting boolean is synced to backend, which
  lights up the video button in the Who List.
2023-01-26 20:34:58 -08:00

33 lines
909 B
Go

package barertc
type Message struct {
Action string `json:"action,omitempty"`
Username string `json:"username"`
Message string `json:"message"`
// 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
}
const (
// Actions sent by the client side only
ActionLogin = "login" // post the username to backend
// Actions sent by server or client
ActionMessage = "message" // post a message to the room
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
)
// WhoList is a member entry in the chat room.
type WhoList struct {
Username string `json:"username"`
VideoActive bool `json:"videoActive"`
}