Skip to content

Commit

Permalink
Add messages for room and plugin disconnect, improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelWei committed Jan 1, 2025
1 parent 3e1b9fa commit a56eb67
Show file tree
Hide file tree
Showing 2 changed files with 484 additions and 188 deletions.
16 changes: 16 additions & 0 deletions room-hub/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ const (
MessageTypeVerificationCodeAccepted MessageType = "VerificationCodeAccepted" // the server sends a message to the plugin that the verification code was accepted and the config
MessageTypeVerificationCodeRejected MessageType = "VerificationCodeRejected" // the server sends a message to the plugin that the verification code was not accepted
MessageTypeJoinURLs MessageType = "JoinURLs" // the plugin generates join urls for the room appliance, this message is send from the plugin to the server and then forwarded to the appliance
MessageTypeRoomDisconnected MessageType = "RoomDisconnected" // the server sends a message to the plugin that the room appliance has disconnected
MessageTypePluginDisconnected MessageType = "PluginDisconnected" // the server sends a message to the plugin that the plugin has disconnected
)

// Messages
type BaseMessage struct {
Type MessageType `json:"type" validate:"required"`
}

type PingMessage struct {
Type MessageType `json:"type" validate:"required"`
}
Expand Down Expand Up @@ -102,3 +108,13 @@ type JoinURLs struct {
ControlURL string `json:"control" validate:"required"`
ScreenURLs map[string]interface{} `json:"screens" validate:"required"`
}

// Room Disconnected Message
type RoomDisconnectedMessage struct {
Type MessageType `json:"type" validate:"required"`
}

// Plugin Disconnected Message
type PluginDisconnectedMessage struct {
Type MessageType `json:"type" validate:"required"`
}
Loading

0 comments on commit a56eb67

Please sign in to comment.