Documentation ¶
Index ¶
- Constants
- func WarnUnknownProxyKeys(jsonProxies []byte)
- type CacheEmptyHandlerFunc
- type CacheEmptyProxy
- type CacheHandler
- type CacheHandlerConfig
- type ChannelStreamReader
- type Client
- type Config
- type ConnectExtra
- type ConnectHandler
- type ConnectHandlerConfig
- type ConnectProxy
- type ConnectingHandlerFunc
- type GRPCCacheEmptyProxy
- type GRPCConnectProxy
- type GRPCPublishProxy
- type GRPCRPCProxy
- type GRPCRefreshProxy
- type GRPCSubRefreshProxy
- type GRPCSubscribeProxy
- type HTTPCacheEmptyProxy
- type HTTPCaller
- type HTTPConnectProxy
- type HTTPPublishProxy
- type HTTPRPCProxy
- type HTTPRefreshProxy
- type HTTPSubRefreshProxy
- type HTTPSubscribeProxy
- type HttpStatusToCodeTransform
- type OnPublication
- type PerCallData
- type PublishHandler
- type PublishHandlerConfig
- type PublishHandlerFunc
- type PublishProxy
- type PublishRequestHTTP
- type RPCHandler
- type RPCHandlerConfig
- type RPCHandlerFunc
- type RPCProxy
- type RefreshExtra
- type RefreshHandler
- type RefreshHandlerConfig
- type RefreshHandlerFunc
- type RefreshProxy
- type RefreshRequestHTTP
- type StreamPublishFunc
- type SubRefreshExtra
- type SubRefreshHandler
- type SubRefreshHandlerConfig
- type SubRefreshHandlerFunc
- type SubRefreshProxy
- type SubRefreshRequestHTTP
- type SubscribeExtra
- type SubscribeHandler
- type SubscribeHandlerConfig
- type SubscribeHandlerFunc
- type SubscribeProxy
- type SubscribeStreamHandler
- type SubscribeStreamHandlerConfig
- type SubscribeStreamHandlerFunc
- type SubscribeStreamProxy
- func (p *SubscribeStreamProxy) SubscribeBidirectional(ctx context.Context) (proxyproto.CentrifugoProxy_SubscribeBidirectionalClient, error)
- func (p *SubscribeStreamProxy) SubscribeStream(ctx context.Context, bidi bool, sr *proxyproto.SubscribeRequest, ...) (*proxyproto.SubscribeResponse, StreamPublishFunc, func(), error)
- func (p *SubscribeStreamProxy) SubscribeUnidirectional(ctx context.Context, req *proxyproto.SubscribeRequest) (proxyproto.CentrifugoProxy_SubscribeUnidirectionalClient, error)
- type TransformDisconnect
- type TransformError
Constants ¶
const DefaultMaxIdleConnsPerHost = 255
DefaultMaxIdleConnsPerHost is a reasonable value for all HTTP clients.
Variables ¶
This section is empty.
Functions ¶
func WarnUnknownProxyKeys ¶
func WarnUnknownProxyKeys(jsonProxies []byte)
WarnUnknownProxyKeys is a helper to find keys not known by Centrifugo in proxy config.
Types ¶
type CacheEmptyHandlerFunc ¶ added in v5.4.0
type CacheEmptyHandlerFunc func( ctx context.Context, channel string, chOpts rule.ChannelOptions) (centrifuge.CacheEmptyReply, error)
CacheEmptyHandlerFunc ...
type CacheEmptyProxy ¶ added in v5.4.0
type CacheEmptyProxy interface { NotifyCacheEmpty(context.Context, *proxyproto.NotifyCacheEmptyRequest) (*proxyproto.NotifyCacheEmptyResponse, error) // Protocol for metrics and logging. Protocol() string }
CacheEmptyProxy allows loading cached data from a source of truth.
func GetCacheEmptyProxy ¶ added in v5.4.0
func GetCacheEmptyProxy(p Config) (CacheEmptyProxy, error)
type CacheHandler ¶ added in v5.4.0
type CacheHandler struct {
// contains filtered or unexported fields
}
CacheHandler ...
func NewCacheHandler ¶ added in v5.4.0
func NewCacheHandler(c CacheHandlerConfig) *CacheHandler
NewCacheHandler ...
func (*CacheHandler) Handle ¶ added in v5.4.0
func (h *CacheHandler) Handle(node *centrifuge.Node) CacheEmptyHandlerFunc
Handle Document.
type CacheHandlerConfig ¶ added in v5.4.0
type CacheHandlerConfig struct { Proxies map[string]CacheEmptyProxy GranularProxyMode bool }
CacheHandlerConfig ...
type ChannelStreamReader ¶ added in v5.1.0
type ChannelStreamReader interface {
Recv() (*proxyproto.StreamSubscribeResponse, error)
}
type Client ¶
type Client interface { ID() string UserID() string Context() context.Context Transport() centrifuge.TransportInfo Unsubscribe(ch string, unsubscribe ...centrifuge.Unsubscribe) WritePublication(channel string, publication *centrifuge.Publication, sp centrifuge.StreamPosition) error }
type Config ¶ added in v5.1.0
type Config struct { // Name is a unique name of proxy to reference. Name string `mapstructure:"name" json:"name"` // Endpoint - HTTP address or GRPC service endpoint. Endpoint string `mapstructure:"endpoint" json:"endpoint"` // Timeout for proxy request. Timeout tools.Duration `mapstructure:"timeout" json:"timeout,omitempty"` // HTTPHeaders is a list of HTTP headers to proxy. No headers used by proxy by default. // If GRPC proxy is used then request HTTP headers set to outgoing request metadata. HttpHeaders []string `mapstructure:"http_headers" json:"http_headers,omitempty"` HttpStatusTransforms []HttpStatusToCodeTransform `mapstructure:"http_status_to_code_transforms" json:"http_status_to_code_transforms,omitempty"` // GRPCMetadata is a list of GRPC metadata keys to proxy. No meta keys used by proxy by // default. If HTTP proxy is used then these keys become outgoing request HTTP headers. GrpcMetadata []string `mapstructure:"grpc_metadata" json:"grpc_metadata,omitempty"` // StaticHttpHeaders is a static set of key/value pairs to attach to HTTP proxy request as // headers. Headers received from HTTP client request or metadata from GRPC client request // both have priority over values set in StaticHttpHeaders map. StaticHttpHeaders map[string]string `mapstructure:"static_http_headers" json:"static_http_headers,omitempty"` // BinaryEncoding makes proxy send data as base64 string (assuming it contains custom // non-JSON payload). BinaryEncoding bool `mapstructure:"binary_encoding" json:"binary_encoding,omitempty"` // IncludeConnectionMeta to each proxy request (except connect where it's obtained). IncludeConnectionMeta bool `mapstructure:"include_connection_meta" json:"include_connection_meta,omitempty"` // GrpcTLS is a common configuration for GRPC TLS. GrpcTLS tools.TLSConfig `mapstructure:"grpc_tls" json:"grpc_tls,omitempty"` // GrpcCertFile is a path to GRPC cert file on disk. GrpcCertFile string `mapstructure:"grpc_cert_file" json:"grpc_cert_file,omitempty"` // GrpcCredentialsKey is a custom key to add into per-RPC credentials. GrpcCredentialsKey string `mapstructure:"grpc_credentials_key" json:"grpc_credentials_key,omitempty"` // GrpcCredentialsValue is a custom value for GrpcCredentialsKey. GrpcCredentialsValue string `mapstructure:"grpc_credentials_value" json:"grpc_credentials_value,omitempty"` // GrpcCompression enables compression for outgoing calls (gzip). GrpcCompression bool `mapstructure:"grpc_compression" json:"grpc_compression,omitempty"` // contains filtered or unexported fields }
Config for proxy.
type ConnectExtra ¶
type ConnectExtra struct { }
type ConnectHandler ¶
type ConnectHandler struct {
// contains filtered or unexported fields
}
ConnectHandler ...
func NewConnectHandler ¶
func NewConnectHandler(c ConnectHandlerConfig, ruleContainer *rule.Container) *ConnectHandler
NewConnectHandler ...
func (*ConnectHandler) Handle ¶
func (h *ConnectHandler) Handle(node *centrifuge.Node) ConnectingHandlerFunc
Handle returns connecting handler func.
type ConnectHandlerConfig ¶
type ConnectHandlerConfig struct {
Proxy ConnectProxy
}
ConnectHandlerConfig ...
type ConnectProxy ¶
type ConnectProxy interface { ProxyConnect(context.Context, *proxyproto.ConnectRequest) (*proxyproto.ConnectResponse, error) // Protocol for metrics and logging. Protocol() string // UseBase64 for bytes in requests from Centrifugo to application backend. UseBase64() bool }
ConnectProxy allows to proxy connect requests to application backend to authenticate client connection.
func GetConnectProxy ¶
func GetConnectProxy(p Config) (ConnectProxy, error)
type ConnectingHandlerFunc ¶
type ConnectingHandlerFunc func(context.Context, centrifuge.ConnectEvent) (centrifuge.ConnectReply, ConnectExtra, error)
type GRPCCacheEmptyProxy ¶ added in v5.4.0
type GRPCCacheEmptyProxy struct {
// contains filtered or unexported fields
}
GRPCCacheEmptyProxy ...
func NewGRPCCacheEmptyProxy ¶ added in v5.4.0
func NewGRPCCacheEmptyProxy(p Config) (*GRPCCacheEmptyProxy, error)
NewGRPCCacheEmptyProxy ...
func (*GRPCCacheEmptyProxy) NotifyCacheEmpty ¶ added in v5.4.0
func (p *GRPCCacheEmptyProxy) NotifyCacheEmpty(ctx context.Context, req *proxyproto.NotifyCacheEmptyRequest) (*proxyproto.NotifyCacheEmptyResponse, error)
CacheEmpty ...
func (*GRPCCacheEmptyProxy) Protocol ¶ added in v5.4.0
func (p *GRPCCacheEmptyProxy) Protocol() string
Protocol ...
func (*GRPCCacheEmptyProxy) UseBase64 ¶ added in v5.4.0
func (p *GRPCCacheEmptyProxy) UseBase64() bool
UseBase64 ...
type GRPCConnectProxy ¶
type GRPCConnectProxy struct {
// contains filtered or unexported fields
}
GRPCConnectProxy ...
func NewGRPCConnectProxy ¶
func NewGRPCConnectProxy(p Config) (*GRPCConnectProxy, error)
NewGRPCConnectProxy ...
func (*GRPCConnectProxy) ProxyConnect ¶
func (p *GRPCConnectProxy) ProxyConnect(ctx context.Context, req *proxyproto.ConnectRequest) (*proxyproto.ConnectResponse, error)
ProxyConnect proxies connect control to application backend.
type GRPCPublishProxy ¶
type GRPCPublishProxy struct {
// contains filtered or unexported fields
}
GRPCPublishProxy ...
func NewGRPCPublishProxy ¶
func NewGRPCPublishProxy(p Config) (*GRPCPublishProxy, error)
NewGRPCPublishProxy ...
func (*GRPCPublishProxy) IncludeMeta ¶
func (p *GRPCPublishProxy) IncludeMeta() bool
IncludeMeta ...
func (*GRPCPublishProxy) ProxyPublish ¶
func (p *GRPCPublishProxy) ProxyPublish(ctx context.Context, req *proxyproto.PublishRequest) (*proxyproto.PublishResponse, error)
ProxyPublish proxies Publish to application backend.
type GRPCRPCProxy ¶
type GRPCRPCProxy struct {
// contains filtered or unexported fields
}
GRPCRPCProxy ...
func (*GRPCRPCProxy) ProxyRPC ¶
func (p *GRPCRPCProxy) ProxyRPC(ctx context.Context, req *proxyproto.RPCRequest) (*proxyproto.RPCResponse, error)
ProxyRPC ...
type GRPCRefreshProxy ¶
type GRPCRefreshProxy struct {
// contains filtered or unexported fields
}
GRPCRefreshProxy ...
func NewGRPCRefreshProxy ¶
func NewGRPCRefreshProxy(p Config) (*GRPCRefreshProxy, error)
NewGRPCRefreshProxy ...
func (*GRPCRefreshProxy) IncludeMeta ¶
func (p *GRPCRefreshProxy) IncludeMeta() bool
IncludeMeta ...
func (*GRPCRefreshProxy) ProxyRefresh ¶
func (p *GRPCRefreshProxy) ProxyRefresh(ctx context.Context, req *proxyproto.RefreshRequest) (*proxyproto.RefreshResponse, error)
ProxyRefresh proxies refresh to application backend.
type GRPCSubRefreshProxy ¶
type GRPCSubRefreshProxy struct {
// contains filtered or unexported fields
}
GRPCSubRefreshProxy ...
func NewGRPCSubRefreshProxy ¶
func NewGRPCSubRefreshProxy(p Config) (*GRPCSubRefreshProxy, error)
NewGRPCSubRefreshProxy ...
func (*GRPCSubRefreshProxy) IncludeMeta ¶
func (p *GRPCSubRefreshProxy) IncludeMeta() bool
IncludeMeta ...
func (*GRPCSubRefreshProxy) ProxySubRefresh ¶
func (p *GRPCSubRefreshProxy) ProxySubRefresh(ctx context.Context, req *proxyproto.SubRefreshRequest) (*proxyproto.SubRefreshResponse, error)
ProxySubRefresh proxies refresh to application backend.
func (*GRPCSubRefreshProxy) UseBase64 ¶
func (p *GRPCSubRefreshProxy) UseBase64() bool
UseBase64 ...
type GRPCSubscribeProxy ¶
type GRPCSubscribeProxy struct {
// contains filtered or unexported fields
}
GRPCSubscribeProxy ...
func NewGRPCSubscribeProxy ¶
func NewGRPCSubscribeProxy(p Config) (*GRPCSubscribeProxy, error)
NewGRPCSubscribeProxy ...
func (*GRPCSubscribeProxy) IncludeMeta ¶
func (p *GRPCSubscribeProxy) IncludeMeta() bool
IncludeMeta ...
func (*GRPCSubscribeProxy) ProxySubscribe ¶
func (p *GRPCSubscribeProxy) ProxySubscribe(ctx context.Context, req *proxyproto.SubscribeRequest) (*proxyproto.SubscribeResponse, error)
ProxySubscribe proxies Subscribe to application backend.
type HTTPCacheEmptyProxy ¶ added in v5.4.0
type HTTPCacheEmptyProxy struct {
// contains filtered or unexported fields
}
HTTPCacheEmptyProxy ...
func NewHTTPCacheEmptyProxy ¶ added in v5.4.0
func NewHTTPCacheEmptyProxy(p Config) (*HTTPCacheEmptyProxy, error)
NewHTTPCacheEmptyProxy ...
func (*HTTPCacheEmptyProxy) NotifyCacheEmpty ¶ added in v5.4.0
func (p *HTTPCacheEmptyProxy) NotifyCacheEmpty(ctx context.Context, req *proxyproto.NotifyCacheEmptyRequest) (*proxyproto.NotifyCacheEmptyResponse, error)
NotifyCacheEmpty ...
func (*HTTPCacheEmptyProxy) Protocol ¶ added in v5.4.0
func (p *HTTPCacheEmptyProxy) Protocol() string
Protocol ...
func (*HTTPCacheEmptyProxy) UseBase64 ¶ added in v5.4.0
func (p *HTTPCacheEmptyProxy) UseBase64() bool
UseBase64 ...
type HTTPCaller ¶
type HTTPCaller interface {
CallHTTP(context.Context, string, http.Header, []byte) ([]byte, error)
}
HTTPCaller is responsible for calling HTTP.
func NewHTTPCaller ¶
func NewHTTPCaller(httpClient *http.Client) HTTPCaller
NewHTTPCaller creates new HTTPCaller.
type HTTPConnectProxy ¶
type HTTPConnectProxy struct {
// contains filtered or unexported fields
}
HTTPConnectProxy ...
func NewHTTPConnectProxy ¶
func NewHTTPConnectProxy(p Config) (*HTTPConnectProxy, error)
NewHTTPConnectProxy ...
func (*HTTPConnectProxy) ProxyConnect ¶
func (p *HTTPConnectProxy) ProxyConnect(ctx context.Context, req *proxyproto.ConnectRequest) (*proxyproto.ConnectResponse, error)
ProxyConnect proxies connect control to application backend.
type HTTPPublishProxy ¶
type HTTPPublishProxy struct {
// contains filtered or unexported fields
}
HTTPPublishProxy ...
func NewHTTPPublishProxy ¶
func NewHTTPPublishProxy(p Config) (*HTTPPublishProxy, error)
NewHTTPPublishProxy ...
func (*HTTPPublishProxy) IncludeMeta ¶
func (p *HTTPPublishProxy) IncludeMeta() bool
IncludeMeta ...
func (*HTTPPublishProxy) ProxyPublish ¶
func (p *HTTPPublishProxy) ProxyPublish(ctx context.Context, req *proxyproto.PublishRequest) (*proxyproto.PublishResponse, error)
ProxyPublish proxies Publish to application backend.
type HTTPRPCProxy ¶
type HTTPRPCProxy struct {
// contains filtered or unexported fields
}
HTTPRPCProxy ...
func (*HTTPRPCProxy) ProxyRPC ¶
func (p *HTTPRPCProxy) ProxyRPC(ctx context.Context, req *proxyproto.RPCRequest) (*proxyproto.RPCResponse, error)
ProxyRPC ...
type HTTPRefreshProxy ¶
type HTTPRefreshProxy struct {
// contains filtered or unexported fields
}
HTTPRefreshProxy ...
func NewHTTPRefreshProxy ¶
func NewHTTPRefreshProxy(p Config) (*HTTPRefreshProxy, error)
NewHTTPRefreshProxy ...
func (*HTTPRefreshProxy) IncludeMeta ¶
func (p *HTTPRefreshProxy) IncludeMeta() bool
IncludeMeta ...
func (*HTTPRefreshProxy) ProxyRefresh ¶
func (p *HTTPRefreshProxy) ProxyRefresh(ctx context.Context, req *proxyproto.RefreshRequest) (*proxyproto.RefreshResponse, error)
ProxyRefresh proxies refresh to application backend.
type HTTPSubRefreshProxy ¶
type HTTPSubRefreshProxy struct {
// contains filtered or unexported fields
}
HTTPSubRefreshProxy ...
func NewHTTPSubRefreshProxy ¶
func NewHTTPSubRefreshProxy(p Config) (*HTTPSubRefreshProxy, error)
NewHTTPSubRefreshProxy ...
func (*HTTPSubRefreshProxy) IncludeMeta ¶
func (p *HTTPSubRefreshProxy) IncludeMeta() bool
IncludeMeta ...
func (*HTTPSubRefreshProxy) ProxySubRefresh ¶
func (p *HTTPSubRefreshProxy) ProxySubRefresh(ctx context.Context, req *proxyproto.SubRefreshRequest) (*proxyproto.SubRefreshResponse, error)
ProxySubRefresh proxies refresh to application backend.
func (*HTTPSubRefreshProxy) UseBase64 ¶
func (p *HTTPSubRefreshProxy) UseBase64() bool
UseBase64 ...
type HTTPSubscribeProxy ¶
type HTTPSubscribeProxy struct {
// contains filtered or unexported fields
}
HTTPSubscribeProxy ...
func NewHTTPSubscribeProxy ¶
func NewHTTPSubscribeProxy(p Config) (*HTTPSubscribeProxy, error)
NewHTTPSubscribeProxy ...
func (*HTTPSubscribeProxy) IncludeMeta ¶
func (p *HTTPSubscribeProxy) IncludeMeta() bool
IncludeMeta ...
func (*HTTPSubscribeProxy) ProxySubscribe ¶
func (p *HTTPSubscribeProxy) ProxySubscribe(ctx context.Context, req *proxyproto.SubscribeRequest) (*proxyproto.SubscribeResponse, error)
ProxySubscribe proxies Subscribe to application backend.
type HttpStatusToCodeTransform ¶ added in v5.4.7
type HttpStatusToCodeTransform struct { StatusCode int `mapstructure:"status_code" json:"status_code"` ToError TransformError `mapstructure:"to_error" json:"to_error"` ToDisconnect TransformDisconnect `mapstructure:"to_disconnect" json:"to_disconnect"` }
func (*HttpStatusToCodeTransform) Validate ¶ added in v5.4.7
func (t *HttpStatusToCodeTransform) Validate() error
type OnPublication ¶ added in v5.1.0
type OnPublication func(pub *proxyproto.Publication, err error)
type PerCallData ¶
type PerCallData struct {
Meta json.RawMessage
}
type PublishHandler ¶
type PublishHandler struct {
// contains filtered or unexported fields
}
PublishHandler ...
func NewPublishHandler ¶
func NewPublishHandler(c PublishHandlerConfig) *PublishHandler
NewPublishHandler ...
func (*PublishHandler) Handle ¶
func (h *PublishHandler) Handle(node *centrifuge.Node) PublishHandlerFunc
Handle Publish.
type PublishHandlerConfig ¶
type PublishHandlerConfig struct { Proxies map[string]PublishProxy GranularProxyMode bool }
PublishHandlerConfig ...
type PublishHandlerFunc ¶
type PublishHandlerFunc func(Client, centrifuge.PublishEvent, rule.ChannelOptions, PerCallData) (centrifuge.PublishReply, error)
PublishHandlerFunc ...
type PublishProxy ¶
type PublishProxy interface { ProxyPublish(context.Context, *proxyproto.PublishRequest) (*proxyproto.PublishResponse, error) // Protocol for metrics and logging. Protocol() string // UseBase64 for bytes in requests from Centrifugo to application backend. UseBase64() bool // IncludeMeta ... IncludeMeta() bool }
PublishProxy allows to send Publish requests.
func GetPublishProxy ¶
func GetPublishProxy(p Config) (PublishProxy, error)
type PublishRequestHTTP ¶
type PublishRequestHTTP struct { UserID string `json:"user"` Channel string `json:"channel"` Data json.RawMessage `json:"data,omitempty"` // Base64Data to proxy binary data. Base64Data string `json:"b64data,omitempty"` // contains filtered or unexported fields }
PublishRequestHTTP ...
type RPCHandler ¶
type RPCHandler struct {
// contains filtered or unexported fields
}
RPCHandler ...
func (*RPCHandler) Handle ¶
func (h *RPCHandler) Handle(node *centrifuge.Node) RPCHandlerFunc
Handle RPC.
type RPCHandlerConfig ¶
RPCHandlerConfig ...
type RPCHandlerFunc ¶
type RPCHandlerFunc func(Client, centrifuge.RPCEvent, *rule.Container, PerCallData) (centrifuge.RPCReply, error)
RPCHandlerFunc ...
type RPCProxy ¶
type RPCProxy interface { ProxyRPC(context.Context, *proxyproto.RPCRequest) (*proxyproto.RPCResponse, error) // Protocol for metrics and logging. Protocol() string // UseBase64 for bytes in requests from Centrifugo to application backend. UseBase64() bool // IncludeMeta ... IncludeMeta() bool }
RPCProxy allows to proxy RPC requests to application backend.
func GetRpcProxy ¶
type RefreshExtra ¶
type RefreshExtra struct {
Meta json.RawMessage
}
type RefreshHandler ¶
type RefreshHandler struct {
// contains filtered or unexported fields
}
RefreshHandler ...
func NewRefreshHandler ¶
func NewRefreshHandler(c RefreshHandlerConfig) *RefreshHandler
NewRefreshHandler ...
func (*RefreshHandler) Handle ¶
func (h *RefreshHandler) Handle(node *centrifuge.Node) RefreshHandlerFunc
Handle refresh.
type RefreshHandlerConfig ¶
type RefreshHandlerConfig struct {
Proxy RefreshProxy
}
RefreshHandlerConfig ...
type RefreshHandlerFunc ¶
type RefreshHandlerFunc func(Client, centrifuge.RefreshEvent, PerCallData) (centrifuge.RefreshReply, RefreshExtra, error)
RefreshHandlerFunc ...
type RefreshProxy ¶
type RefreshProxy interface { ProxyRefresh(context.Context, *proxyproto.RefreshRequest) (*proxyproto.RefreshResponse, error) // Protocol for metrics and logging. Protocol() string // UseBase64 for bytes in requests from Centrifugo to application backend. UseBase64() bool // IncludeMeta ... IncludeMeta() bool }
RefreshProxy allows to send refresh requests.
func GetRefreshProxy ¶
func GetRefreshProxy(p Config) (RefreshProxy, error)
type RefreshRequestHTTP ¶
type RefreshRequestHTTP struct { UserID string `json:"user"` // contains filtered or unexported fields }
RefreshRequestHTTP ...
type StreamPublishFunc ¶ added in v5.1.0
StreamPublishFunc ...
type SubRefreshExtra ¶
type SubRefreshExtra struct { }
type SubRefreshHandler ¶
type SubRefreshHandler struct {
// contains filtered or unexported fields
}
SubRefreshHandler ...
func NewSubRefreshHandler ¶
func NewSubRefreshHandler(c SubRefreshHandlerConfig) *SubRefreshHandler
NewSubRefreshHandler ...
func (*SubRefreshHandler) Handle ¶
func (h *SubRefreshHandler) Handle(node *centrifuge.Node) SubRefreshHandlerFunc
Handle refresh.
type SubRefreshHandlerConfig ¶
type SubRefreshHandlerConfig struct { Proxies map[string]SubRefreshProxy GranularProxyMode bool }
SubRefreshHandlerConfig ...
type SubRefreshHandlerFunc ¶
type SubRefreshHandlerFunc func(Client, centrifuge.SubRefreshEvent, rule.ChannelOptions, PerCallData) (centrifuge.SubRefreshReply, SubRefreshExtra, error)
SubRefreshHandlerFunc ...
type SubRefreshProxy ¶
type SubRefreshProxy interface { ProxySubRefresh(context.Context, *proxyproto.SubRefreshRequest) (*proxyproto.SubRefreshResponse, error) // Protocol for metrics and logging. Protocol() string // UseBase64 for bytes in requests from Centrifugo to application backend. UseBase64() bool // IncludeMeta ... IncludeMeta() bool }
SubRefreshProxy allows to send sub refresh requests.
func GetSubRefreshProxy ¶
func GetSubRefreshProxy(p Config) (SubRefreshProxy, error)
type SubRefreshRequestHTTP ¶
type SubRefreshRequestHTTP struct { UserID string `json:"user"` Channel string `json:"channel"` // contains filtered or unexported fields }
SubRefreshRequestHTTP ...
type SubscribeExtra ¶
type SubscribeExtra struct { }
type SubscribeHandler ¶
type SubscribeHandler struct {
// contains filtered or unexported fields
}
SubscribeHandler ...
func NewSubscribeHandler ¶
func NewSubscribeHandler(c SubscribeHandlerConfig) *SubscribeHandler
NewSubscribeHandler ...
func (*SubscribeHandler) Handle ¶
func (h *SubscribeHandler) Handle(node *centrifuge.Node) SubscribeHandlerFunc
Handle Subscribe.
type SubscribeHandlerConfig ¶
type SubscribeHandlerConfig struct { Proxies map[string]SubscribeProxy GranularProxyMode bool }
SubscribeHandlerConfig ...
type SubscribeHandlerFunc ¶
type SubscribeHandlerFunc func(Client, centrifuge.SubscribeEvent, rule.ChannelOptions, PerCallData) (centrifuge.SubscribeReply, SubscribeExtra, error)
SubscribeHandlerFunc ...
type SubscribeProxy ¶
type SubscribeProxy interface { ProxySubscribe(context.Context, *proxyproto.SubscribeRequest) (*proxyproto.SubscribeResponse, error) // Protocol for metrics and logging. Protocol() string // UseBase64 for bytes in requests from Centrifugo to application backend. UseBase64() bool // IncludeMeta ... IncludeMeta() bool }
SubscribeProxy allows to send Subscribe requests.
func GetSubscribeProxy ¶
func GetSubscribeProxy(p Config) (SubscribeProxy, error)
type SubscribeStreamHandler ¶ added in v5.1.0
type SubscribeStreamHandler struct {
// contains filtered or unexported fields
}
SubscribeStreamHandler ...
func NewSubscribeStreamHandler ¶ added in v5.1.0
func NewSubscribeStreamHandler(c SubscribeStreamHandlerConfig) *SubscribeStreamHandler
NewSubscribeStreamHandler ...
func (*SubscribeStreamHandler) Handle ¶ added in v5.1.0
func (h *SubscribeStreamHandler) Handle(node *centrifuge.Node) SubscribeStreamHandlerFunc
Handle ...
type SubscribeStreamHandlerConfig ¶ added in v5.1.0
type SubscribeStreamHandlerConfig struct { Proxies map[string]*SubscribeStreamProxy GranularProxyMode bool }
SubscribeStreamHandlerConfig ...
type SubscribeStreamHandlerFunc ¶ added in v5.1.0
type SubscribeStreamHandlerFunc func( Client, bool, centrifuge.SubscribeEvent, rule.ChannelOptions, PerCallData, ) (centrifuge.SubscribeReply, StreamPublishFunc, func(), error)
SubscribeStreamHandlerFunc ...
type SubscribeStreamProxy ¶ added in v5.1.0
type SubscribeStreamProxy struct {
// contains filtered or unexported fields
}
func NewSubscribeStreamProxy ¶ added in v5.1.0
func NewSubscribeStreamProxy(p Config) (*SubscribeStreamProxy, error)
func (*SubscribeStreamProxy) SubscribeBidirectional ¶ added in v5.1.0
func (p *SubscribeStreamProxy) SubscribeBidirectional(ctx context.Context) (proxyproto.CentrifugoProxy_SubscribeBidirectionalClient, error)
SubscribeBidirectional ...
func (*SubscribeStreamProxy) SubscribeStream ¶ added in v5.1.0
func (p *SubscribeStreamProxy) SubscribeStream( ctx context.Context, bidi bool, sr *proxyproto.SubscribeRequest, pubFunc OnPublication, ) (*proxyproto.SubscribeResponse, StreamPublishFunc, func(), error)
SubscribeStream ...
func (*SubscribeStreamProxy) SubscribeUnidirectional ¶ added in v5.1.0
func (p *SubscribeStreamProxy) SubscribeUnidirectional(ctx context.Context, req *proxyproto.SubscribeRequest) (proxyproto.CentrifugoProxy_SubscribeUnidirectionalClient, error)
SubscribeUnidirectional ...
type TransformDisconnect ¶ added in v5.4.7
type TransformError ¶ added in v5.4.7
Source Files ¶
- cache.go
- cache_grpc.go
- cache_handler.go
- cache_http.go
- client.go
- connect.go
- connect_grpc.go
- connect_handler.go
- connect_http.go
- grpc.go
- http.go
- metrics.go
- proxy.go
- publish.go
- publish_grpc.go
- publish_handler.go
- publish_http.go
- refresh.go
- refresh_grpc.go
- refresh_handler.go
- refresh_http.go
- rpc.go
- rpc_grpc.go
- rpc_handler.go
- rpc_http.go
- sub_refresh.go
- sub_refresh_grpc.go
- sub_refresh_handler.go
- sub_refresh_http.go
- subscribe.go
- subscribe_grpc.go
- subscribe_handler.go
- subscribe_http.go
- subscribe_stream_grpc.go
- subscribe_stream_handler.go
- test_grpc_server.go
- unknown_keys.go