func NewWebsocketHandler(n *Node, c WebsocketConfig) *WebsocketHandler {
	upgrader := &websocket.Upgrader{
		ReadBufferSize:    c.ReadBufferSize,
		EnableCompression: c.Compression,
	}
	if c.UseWriteBufferPool {
		upgrader.WriteBufferPool = writeBufferPool
	} else {
		upgrader.WriteBufferSize = c.WriteBufferSize
	}
	if c.CheckOrigin != nil {
		upgrader.CheckOrigin = c.CheckOrigin
	} else {
		upgrader.CheckOrigin = func(r *http.Request) bool {
			// Allow all connections.
			return true
		}
	}
	return &WebsocketHandler{
		node:     n,
		config:   c,
		upgrader: upgrader,
	}
}
// NewWebsocketHandler creates new WebsocketHandler.
NewWebsocketHandler creates new WebsocketHandler.
// NewWebsocketHandler creates new WebsocketHandler .
func NewWebsocketHandler(n *Node, c WebsocketConfig) *WebsocketHandler {
	upgrader := &websocket.Upgrader{
		ReadBufferSize:    c.ReadBufferSize,
		EnableCompression: c.Compression,
	}
	if c.UseWriteBufferPool {
		upgrader.WriteBufferPool = writeBufferPool
	} else {
		upgrader.WriteBufferSize = c.WriteBufferSize
	}
	if c.CheckOrigin != nil {
		upgrader.CheckOrigin = c.CheckOrigin
	} else {
		upgrader.CheckOrigin = func(r *http.Request) bool {
			return true
		}
	}
	return &WebsocketHandler{
		node:     n,
		config:   c,
		upgrader: upgrader,
	}
}
func NewWebsocketHandler ( n * Node , c WebsocketConfig ) * WebsocketHandler { upgrader := & websocket . Upgrader { ReadBufferSize : c . ReadBufferSize , EnableCompression : c . Compression , } if c . UseWriteBufferPool { upgrader . WriteBufferPool = writeBufferPool } else { upgrader . WriteBufferSize = c . WriteBufferSize } if c . CheckOrigin != nil { upgrader . CheckOrigin = c . CheckOrigin } else { upgrader . CheckOrigin = func ( r * http . Request ) bool { return true } } return & WebsocketHandler { node : n , config : c , upgrader : upgrader , } }
NewWebsocketHandler creates new WebsocketHandler.
NewWebsocketHandler creates new WebsocketHandler .
// Allow all connections.