25 lines
598 B
Go
25 lines
598 B
Go
package ws
|
|
|
|
import "time"
|
|
|
|
const (
|
|
EventWelcome = "welcome"
|
|
EventMessage = "message"
|
|
EventPresence = "presence"
|
|
EventError = "error"
|
|
)
|
|
|
|
type IncomingMessage struct {
|
|
Type string `json:"type" binding:"required" example:"message"`
|
|
Data string `json:"data" binding:"required" example:"hello"`
|
|
}
|
|
|
|
type OutgoingMessage struct {
|
|
Type string `json:"type"`
|
|
Room string `json:"room,omitempty"`
|
|
ClientID string `json:"client_id,omitempty"`
|
|
Data string `json:"data,omitempty"`
|
|
Online int `json:"online,omitempty"`
|
|
Timestamp time.Time `json:"timestamp"`
|
|
}
|