You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.2 KiB
Go
66 lines
2.2 KiB
Go
package entities
|
|
|
|
type ClientMessage struct {
|
|
UserName string `json:"username,omitempty"`
|
|
Room string `json:"room,omitempty"`
|
|
URL string `json:"url,omitempty"`
|
|
PlayTime int64 `json:"playTime,omitempty"`
|
|
Playing bool `json:"playing,omitempty"`
|
|
Payload string `json:"payload,omitempty"`
|
|
Password string `json:"password,omitempty"`
|
|
}
|
|
|
|
type ServerMessage struct {
|
|
Type string `json:"type,omitempty"` // "roomInfo", "stateChanged", etc.
|
|
}
|
|
|
|
type RoomStateChangedMessage struct {
|
|
Type string `json:"type,omitempty"` // "roomInfo", "stateChanged", etc.
|
|
ServerTime int64 `json:"serverTime,omitempty"`
|
|
URL string `json:"url,omitempty"`
|
|
PlayTime int64 `json:"playTime,omitempty"`
|
|
Playing bool `json:"playing,omitempty"`
|
|
UserStatus []UserStatus `json:"userStatus,omitempty"`
|
|
}
|
|
|
|
type UserJoinLeaveMessage struct {
|
|
Type string `json:"type,omitempty"` // "userJoin", "userLeave"
|
|
UserInfo UserStatus `json:"userInfo,omitempty"` // User information
|
|
}
|
|
|
|
type UserActionMessage struct {
|
|
Type string `json:"type,omitempty"` // "play", "pause"
|
|
FromUser UserStatus `json:"fromUser,omitempty"` // User who set the time
|
|
}
|
|
|
|
type SetTimeMessage struct {
|
|
Type string `json:"type"`
|
|
PlayTime int64 `json:"playTime"`
|
|
FromUser UserStatus `json:"fromUser"`
|
|
}
|
|
|
|
type ServerNotificationMessage struct {
|
|
Type string `json:"type,omitempty"` // "message"
|
|
Severity string `json:"severity,omitempty"` // "info", "warning", "error"
|
|
Message string `json:"message,omitempty"` // notification message
|
|
Title string `json:"title,omitempty"` // notification title
|
|
}
|
|
|
|
type UserStatus struct {
|
|
UserID string `json:"userID,omitempty"`
|
|
UserName string `json:"username,omitempty"`
|
|
IsAdmin bool `json:"isAdmin"`
|
|
PlayTime int64 `json:"playTime,omitempty"`
|
|
UpdateTime int64 `json:"updateTime,omitempty"`
|
|
Playing bool `json:"playing,omitempty"`
|
|
}
|
|
|
|
var MessageTypeRoomInfo = "roomInfo"
|
|
var MessageTypeUserJoin = "userJoin"
|
|
var MessageTypeUserLeave = "userLeave"
|
|
var MessageTypeMessage = "message"
|
|
var MessageTypePause = "pause"
|
|
var MessageTypePlay = "play"
|
|
var MessageTypeSetUrl = "setUrl"
|
|
var MessageTypeSetTime = "setTime"
|