Documentation ¶
Overview ¶
This package holds the connection interface implementations to be used by project
Index ¶
- func OptimizedRequestHandler(context *gin.Context)
- func RequestHandler(context *gin.Context)
- type OWebSocketConnection
- func (connection *OWebSocketConnection) Close()
- func (connection *OWebSocketConnection) Init(ws net.Conn)
- func (connection *OWebSocketConnection) IsConnected() bool
- func (connection *OWebSocketConnection) Send(data []byte)
- func (connection *OWebSocketConnection) SendText(data []byte)
- func (connection *OWebSocketConnection) SetOnClose(cb func())
- func (connection *OWebSocketConnection) SetOnHeartBeat(cb func())
- func (connection *OWebSocketConnection) SetOnMessage(cb func([]byte))
- type SSEConnection
- func (connection *SSEConnection) Close()
- func (connection *SSEConnection) Init()
- func (connection *SSEConnection) Send(payload []byte)
- func (connection *SSEConnection) SendText(payload []byte)
- func (connection *SSEConnection) SetOnClose(cb func())
- func (connection *SSEConnection) SetOnMessage(cb func([]byte))
- type WebSocketConnection
- func (connection *WebSocketConnection) Close()
- func (connection *WebSocketConnection) Init(ws *websocket.Conn)
- func (connection *WebSocketConnection) IsConnected() bool
- func (connection *WebSocketConnection) Send(data []byte)
- func (connection *WebSocketConnection) SendText(data []byte)
- func (connection *WebSocketConnection) SetOnClose(cb func())
- func (connection *WebSocketConnection) SetOnHeartBeat(cb func())
- func (connection *WebSocketConnection) SetOnMessage(cb func([]byte))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OptimizedRequestHandler ¶
OptimizedRequestHandler - Optimized version of WebSocket handshake
func RequestHandler ¶
RequestHandler - Default WebSocket handler
Types ¶
type OWebSocketConnection ¶
type OWebSocketConnection struct {
// contains filtered or unexported fields
}
OWebSocketConnection - O stands for optimized Implementation of the Connection interface for WebSocket clients
func (*OWebSocketConnection) Close ¶
func (connection *OWebSocketConnection) Close()
Close - Close the current connection
func (*OWebSocketConnection) Init ¶
func (connection *OWebSocketConnection) Init(ws net.Conn)
Init - Initialize connection and start reading and writing messages
func (*OWebSocketConnection) IsConnected ¶
func (connection *OWebSocketConnection) IsConnected() bool
IsConnected - If connection is still alive
func (*OWebSocketConnection) Send ¶
func (connection *OWebSocketConnection) Send(data []byte)
Send - Send the data to the client
func (*OWebSocketConnection) SendText ¶
func (connection *OWebSocketConnection) SendText(data []byte)
SendText - Send the data to the client
func (*OWebSocketConnection) SetOnClose ¶
func (connection *OWebSocketConnection) SetOnClose(cb func())
SetOnClose - Set on closed connection handler
func (*OWebSocketConnection) SetOnHeartBeat ¶
func (connection *OWebSocketConnection) SetOnHeartBeat(cb func())
func (*OWebSocketConnection) SetOnMessage ¶
func (connection *OWebSocketConnection) SetOnMessage(cb func([]byte))
SetOnMessage - Set user sent message callback
type SSEConnection ¶
type SSEConnection struct {
// contains filtered or unexported fields
}
SSEConnection - Implementation of the Connection interface for Server Sent Event clients
func (*SSEConnection) Close ¶
func (connection *SSEConnection) Close()
Close - Close the current connection
func (*SSEConnection) Init ¶
func (connection *SSEConnection) Init()
Init - Initialize connection channels
func (*SSEConnection) Send ¶
func (connection *SSEConnection) Send(payload []byte)
Send - Enqueue message into channel
func (*SSEConnection) SendText ¶
func (connection *SSEConnection) SendText(payload []byte)
SendText - Enqueue message into channel
func (*SSEConnection) SetOnClose ¶
func (connection *SSEConnection) SetOnClose(cb func())
SetOnClose - Callback for when connection closes
func (*SSEConnection) SetOnMessage ¶
func (connection *SSEConnection) SetOnMessage(cb func([]byte))
SetOnMessage - In this type of connection the callback won't do anything
type WebSocketConnection ¶
type WebSocketConnection struct {
// contains filtered or unexported fields
}
WebSocketConnection - Implementation of the Connection interface for WebSocket clients
func (*WebSocketConnection) Close ¶
func (connection *WebSocketConnection) Close()
Close - Close the current connection
func (*WebSocketConnection) Init ¶
func (connection *WebSocketConnection) Init(ws *websocket.Conn)
Init - Initialize connection and start reading and writing messages
func (*WebSocketConnection) IsConnected ¶
func (connection *WebSocketConnection) IsConnected() bool
IsConnected - If connection is still alive
func (*WebSocketConnection) Send ¶
func (connection *WebSocketConnection) Send(data []byte)
Send - Send the data to the client
func (*WebSocketConnection) SendText ¶
func (connection *WebSocketConnection) SendText(data []byte)
SendText - Send the data to the client
func (*WebSocketConnection) SetOnClose ¶
func (connection *WebSocketConnection) SetOnClose(cb func())
SetOnClose - Set on closed connection handler
func (*WebSocketConnection) SetOnHeartBeat ¶
func (connection *WebSocketConnection) SetOnHeartBeat(cb func())
func (*WebSocketConnection) SetOnMessage ¶
func (connection *WebSocketConnection) SetOnMessage(cb func([]byte))
SetOnMessage - Set user sent message callback