Documentation ¶
Index ¶
Constants ¶
const ( MessageTypeConnectionInit = "connection_init" MessageTypeConnectionAck = "connection_ack" MessageTypeConnectionError = "connection_error" MessageTypeConnectionTerminate = "connection_terminate" MessageTypeConnectionKeepAlive = "ka" MessageTypeStart = "start" MessageTypeStop = "stop" MessageTypeData = "data" MessageTypeError = "error" MessageTypeComplete = "complete" DefaultKeepAliveInterval = "15s" DefaultSubscriptionUpdateInterval = "1s" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // ReadFromClient will invoke a read operation from the client connection. ReadFromClient() (*Message, error) // WriteToClient will invoke a write operation to the client connection. WriteToClient(Message) error // IsConnected will indicate if a connection is still established. IsConnected() bool // Disconnect will close the connection between server and client. Disconnect() error }
client provides an interface which can be implemented by any possible subscription client like websockets, mqtt, etc.
type Executor ¶
type Executor interface { Execute(writer resolve.FlushWriter) error OperationType() ast.OperationType SetContext(context context.Context) Reset() }
Executor is an abstraction for executing a GraphQL engine
type ExecutorPool ¶
ExecutorPool is an abstraction for creating executors
type ExecutorV1 ¶
type ExecutorV1 struct {
// contains filtered or unexported fields
}
func (*ExecutorV1) Execute ¶
func (e *ExecutorV1) Execute(writer resolve.FlushWriter) error
func (*ExecutorV1) OperationType ¶
func (e *ExecutorV1) OperationType() ast.OperationType
func (*ExecutorV1) Reset ¶
func (e *ExecutorV1) Reset()
func (*ExecutorV1) SetContext ¶
func (e *ExecutorV1) SetContext(context context.Context)
type ExecutorV1Pool ¶
type ExecutorV1Pool struct { ExecutionHandler *execution.Handler // contains filtered or unexported fields }
func NewExecutorV1Pool ¶
func NewExecutorV1Pool(executionHandler *execution.Handler) *ExecutorV1Pool
func (*ExecutorV1Pool) Put ¶
func (e *ExecutorV1Pool) Put(executor Executor) error
type ExecutorV2 ¶
type ExecutorV2 struct {
// contains filtered or unexported fields
}
func (*ExecutorV2) Execute ¶
func (e *ExecutorV2) Execute(writer resolve.FlushWriter) error
func (*ExecutorV2) OperationType ¶
func (e *ExecutorV2) OperationType() ast.OperationType
func (*ExecutorV2) Reset ¶
func (e *ExecutorV2) Reset()
func (*ExecutorV2) SetContext ¶
func (e *ExecutorV2) SetContext(context context.Context)
type ExecutorV2Pool ¶
type ExecutorV2Pool struct {
// contains filtered or unexported fields
}
ExecutorV2Pool - provides reusable executors
func NewExecutorV2Pool ¶
func NewExecutorV2Pool(engine *graphql.ExecutionEngineV2, connectionInitReqCtx context.Context) *ExecutorV2Pool
func (*ExecutorV2Pool) Put ¶
func (e *ExecutorV2Pool) Put(executor Executor) error
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is the actual subscription handler which will keep track on how to handle messages coming from the client.
func NewHandler ¶
func NewHandler(logger abstractlogger.Logger, client Client, executorPool ExecutorPool) (*Handler, error)
NewHandler creates a new subscription handler.
func (*Handler) ActiveSubscriptions ¶
ActiveSubscriptions will return the actual number of active subscriptions for that client.
func (*Handler) ChangeKeepAliveInterval ¶
ChangeKeepAliveInterval can be used to change the keep alive interval.
func (*Handler) ChangeSubscriptionUpdateInterval ¶
ChangeSubscriptionUpdateInterval can be used to change the update interval.
type InitialHttpRequestContext ¶
func NewInitialHttpRequestContext ¶
func NewInitialHttpRequestContext(r *http.Request) *InitialHttpRequestContext