Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCancelContext ¶
NewCancelContext returns a wrapper context around original context that will be canceled on channel close.
Types ¶
type Config ¶
type Config struct { // HandlerPrefix sets prefix for SockJS handler endpoint path. HandlerPrefix string // URL is an address to SockJS client javascript library. Required for iframe-based // transports to work. This URL should lead to the same SockJS client version as used // for connecting on the client side. URL string // CheckOrigin allows deciding whether to use CORS or not in XHR case. // When false returned then CORS headers won't be set. CheckOrigin func(*http.Request) bool // WebsocketCheckOrigin allows setting custom CheckOrigin func for underlying // Gorilla Websocket based websocket.Upgrader. WebsocketCheckOrigin func(*http.Request) bool // WebsocketReadBufferSize is a parameter that is used for raw websocket.Upgrader. // If set to zero reasonable default value will be used. WebsocketReadBufferSize int // WebsocketWriteBufferSize is a parameter that is used for raw websocket.Upgrader. // If set to zero reasonable default value will be used. WebsocketWriteBufferSize int // WebsocketUseWriteBufferPool enables using buffer pool for writes in Websocket transport. WebsocketUseWriteBufferPool bool // WebsocketWriteTimeout is maximum time of write message operation. // Slow client will be disconnected. // By default, 1 * time.Second will be used. WebsocketWriteTimeout time.Duration centrifuge.PingPongConfig }
Config represents config for SockJS handler.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler accepts SockJS connections. SockJS has a bunch of fallback transports when WebSocket connection is not supported. It comes with additional costs though: small protocol framing overhead, lack of binary support, more goroutines per connection, and you need to use sticky session mechanism on your load balancer in case you are using HTTP-based SockJS fallbacks and have more than one Centrifuge Node on a backend (so SockJS to be able to emulate bidirectional protocol). So if you can afford it - use WebsocketHandler only.
func NewHandler ¶
func NewHandler(node *centrifuge.Node, config Config) *Handler
NewHandler creates new Handler.