Versions in this module Expand all Collapse all v2 v2.0.1 Jan 7, 2024 Changes in this version + const DefaultKeepAliveInterval + const DefaultReadErrorTimeOut + const DefaultSubscriptionUpdateInterval + const MessageTypeComplete + const MessageTypeConnectionAck + const MessageTypeConnectionError + const MessageTypeConnectionInit + const MessageTypeConnectionKeepAlive + const MessageTypeConnectionTerminate + const MessageTypeData + const MessageTypeError + const MessageTypeStart + const MessageTypeStop + var ErrCouldNotReadMessageFromClient = errors.New("could not read message from client") + var ErrSubscriberIDAlreadyExists = errors.New("subscriber id already exists") + var ErrTransportClientClosedConnection = errors.New("transport client has a closed connection") + func TimeOutChecker(params TimeOutParams) + type Client interface + Disconnect func() error + IsConnected func() bool + ReadFromClient func() (*Message, error) + WriteToClient func(Message) error + type Engine interface + StartOperation func(ctx context.Context, id string, payload []byte, eventHandler EventHandler) error + StopSubscription func(id string, eventHandler EventHandler) error + TerminateAllSubscriptions func(eventHandler EventHandler) error + type EventHandler interface + Emit func(eventType EventType, id string, data []byte, err error) + type EventType int + const EventTypeOnConnectionError + const EventTypeOnConnectionOpened + const EventTypeOnConnectionTerminatedByClient + const EventTypeOnConnectionTerminatedByServer + const EventTypeOnDuplicatedSubscriberID + const EventTypeOnError + const EventTypeOnNonSubscriptionExecutionResult + const EventTypeOnSubscriptionCompleted + const EventTypeOnSubscriptionData + type Executor interface + Execute func(writer resolve.SubscriptionResponseWriter) error + OperationType func() ast.OperationType + Reset func() + SetContext func(context context.Context) + type ExecutorEngine struct + func (e *ExecutorEngine) StartOperation(ctx context.Context, id string, payload []byte, eventHandler EventHandler) error + func (e *ExecutorEngine) StopSubscription(id string, eventHandler EventHandler) error + func (e *ExecutorEngine) TerminateAllSubscriptions(eventHandler EventHandler) error + type ExecutorPool interface + Get func(payload []byte) (Executor, error) + Put func(executor Executor) error + type ExecutorV2 struct + func (e *ExecutorV2) Execute(writer resolve.SubscriptionResponseWriter) error + func (e *ExecutorV2) OperationType() ast.OperationType + func (e *ExecutorV2) Reset() + func (e *ExecutorV2) SetContext(context context.Context) + type ExecutorV2Pool struct + func NewExecutorV2Pool(engine *graphql.ExecutionEngineV2, connectionInitReqCtx context.Context) *ExecutorV2Pool + func (e *ExecutorV2Pool) Get(payload []byte) (Executor, error) + func (e *ExecutorV2Pool) Put(executor Executor) error + type Handler struct + func NewHandler(logger abstractlogger.Logger, client Client, executorPool ExecutorPool) (*Handler, error) + func NewHandlerWithInitFunc(logger abstractlogger.Logger, client Client, executorPool ExecutorPool, ...) (*Handler, error) + func (h *Handler) ActiveSubscriptions() int + func (h *Handler) ChangeKeepAliveInterval(d time.Duration) + func (h *Handler) ChangeSubscriptionUpdateInterval(d time.Duration) + func (h *Handler) Handle(ctx context.Context) + type InitPayload json.RawMessage + func (p InitPayload) Authorization() string + func (p InitPayload) GetString(key string) string + type InitialHttpRequestContext struct + Request *http.Request + func NewInitialHttpRequestContext(r *http.Request) *InitialHttpRequestContext + type Message struct + Id string + Payload json.RawMessage + Type string + type Protocol interface + EventHandler func() EventHandler + Handle func(ctx context.Context, engine Engine, message []byte) error + type TimeOutParams struct + Logger abstractlogger.Logger + Name string + TimeOutAction func() + TimeOutContext context.Context + TimeOutDuration time.Duration + type TransportClient interface + Disconnect func() error + DisconnectWithReason func(reason interface{}) error + IsConnected func() bool + ReadBytesFromClient func() ([]byte, error) + WriteBytesToClient func([]byte) error + type UniversalProtocolHandler struct + func NewUniversalProtocolHandler(client TransportClient, protocol Protocol, executorPool ExecutorPool) (*UniversalProtocolHandler, error) + func NewUniversalProtocolHandlerWithOptions(client TransportClient, protocol Protocol, executorPool ExecutorPool, ...) (*UniversalProtocolHandler, error) + func (u *UniversalProtocolHandler) Handle(ctx context.Context) + type UniversalProtocolHandlerOptions struct + CustomEngine Engine + CustomReadErrorTimeOut time.Duration + CustomSubscriptionUpdateInterval time.Duration + Logger abstractlogger.Logger + type WebsocketInitFunc func(ctx context.Context, initPayload InitPayload) (context.Context, error)