Documentation
¶
Index ¶
- Constants
- Variables
- func AcceptOptions(cfg Config) *websocket.AcceptOptions
- func BackendWSURL(endpoint *config.EndpointConfig, c *gin.Context) (string, error)
- func EncodeEnvelope(env Envelope) ([]byte, error)
- func ExtractHeaders(c *gin.Context, allowed []string) http.Header
- func ExtractParams(c *gin.Context) map[string]string
- func IsConfigured(extra config.ExtraConfig) bool
- func IsWebSocketUpgrade(r *http.Request) bool
- func PingLoop(ctx context.Context, conn *websocket.Conn, period, pongWait time.Duration)
- func ResetHubRegistry()
- func RunDirect(ctx context.Context, client *websocket.Conn, backendURL string, ...)
- func SessionFromParams(params map[string]string, uuid string) map[string]interface{}
- type ClientSession
- type Config
- type Envelope
- type Hub
- type Metrics
Constants ¶
View Source
const Namespace = "websocket"
Variables ¶
View Source
var ErrNoConfig = errors.New("websocket: no config")
Functions ¶
func AcceptOptions ¶
func AcceptOptions(cfg Config) *websocket.AcceptOptions
AcceptOptions builds client accept options from config.
func BackendWSURL ¶
func EncodeEnvelope ¶
func IsConfigured ¶
func IsConfigured(extra config.ExtraConfig) bool
func IsWebSocketUpgrade ¶
func ResetHubRegistry ¶
func ResetHubRegistry()
ResetHubRegistry clears multiplex hubs between tests. It is intended for test isolation only.
Types ¶
type ClientSession ¶
type ClientSession struct {
// contains filtered or unexported fields
}
func NewClientSession ¶
type Config ¶
type Config struct {
BackoffStrategy string
ConnectEvent bool
DisconnectEvent bool
DisableOTELMetrics bool
EnableDirectCommunication bool
InputHeaders []string
MaxMessageSize int64
MaxRetries int
MessageBufferSize int
PingPeriod time.Duration
PongWait time.Duration
ReadBufferSize int
WriteBufferSize int
ReturnErrorDetails bool
Subprotocols []string
Timeout time.Duration
WriteWait time.Duration
}
type Envelope ¶
type Envelope struct {
URL string `json:"url,omitempty"`
Session map[string]interface{} `json:"session,omitempty"`
Body string `json:"body,omitempty"`
}
func DecodeEnvelope ¶
func NewOutboundEnvelope ¶
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
func (*Hub) EnsureBackend ¶
func (*Hub) HandleClient ¶
func (h *Hub) HandleClient(ctx context.Context, s *ClientSession, endpointURL string)
func (*Hub) RegisterClient ¶
func (h *Hub) RegisterClient(s *ClientSession)
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
func GetMetrics ¶
func (*Metrics) ConnectionClosed ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.