Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EchoHandler ¶
func EchoHandler(msg WebSocketMessage, ws *websocket.Conn, c echo.Context) error
func PipelineHandler ¶
func PipelineHandler(msg WebSocketMessage, c *websocket.Conn, ctx echo.Context) error
Types ¶
type MessageHandler ¶
type MessageHandler func(WebSocketMessage, *websocket.Conn, echo.Context) error
type WS ¶
type WS struct {
// contains filtered or unexported fields
}
WS is the representation of the WebSocket handler
func GetWS ¶
func GetWS() *WS
GetWs retrieves the WebSocket singleton, making it if it hasn't been created yet.
func (*WS) RegisterHandle ¶
func (w *WS) RegisterHandle(handler MessageHandler)
type WebSocketMessage ¶
type WebSocketMessage struct { Message string `json:"message"` BinaryData []byte `json:"binary"` Type WebSocketMessageType `json:"type"` }
WebSocketMessage is the shape of messages coming in from the Websocket
func (*WebSocketMessage) Render ¶
func (m *WebSocketMessage) Render(c echo.Context) ([]byte, error)
Render will return either a []byte if WebSocketMessage Type is binary, otherwise it will return a string
type WebSocketMessageType ¶
type WebSocketMessageType string
WebSocketMessageType can be "echo", "message", "binary"
const Binary WebSocketMessageType = "binary"
const Close WebSocketMessageType = "close"
const Echo WebSocketMessageType = "echo"
const Message WebSocketMessageType = "message"
Click to show internal directories.
Click to hide internal directories.