Documentation
¶
Overview ¶
Package wsx provides Fiber-v3-compatible WebSocket support via fasthttp/websocket. The public surface is intentionally small:
app.Get("/ws", wsx.Upgrade(func(c *wsx.Conn) error {
for {
_, msg, err := c.ReadMessage()
if err != nil { return err }
_ = c.WriteMessage(wsx.TextMessage, msg)
}
}))
Index ¶
Constants ¶
View Source
const ( TextMessage = websocket.TextMessage BinaryMessage = websocket.BinaryMessage CloseMessage = websocket.CloseMessage PingMessage = websocket.PingMessage PongMessage = websocket.PongMessage )
Message-type constants re-exported for convenience.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
ReadBufferSize int
WriteBufferSize int
Subprotocols []string
EnableCompression bool
// CheckOrigin defaults to allow-all (zip is multi-tenant; gate via
// CORS or auth middleware at the route level instead).
CheckOrigin func(ctx *fasthttp.RequestCtx) bool
}
Config configures the WebSocket upgrade.
Click to show internal directories.
Click to hide internal directories.