Documentation
¶
Overview ¶
Copyright 2018 The Elasticshift Authors.
Copyright 2018 The Elasticshift Authors.
Copyright 2018 The Elasticshift Authors.
Copyright 2018 The Elasticshift Authors.
Package pubsub ..
Copyright 2018 The Elasticshift Authors.
Copyright 2018 The Elasticshift Authors.
Copyright 2018 The Elasticshift Authors.
Copyright 2018 The Elasticshift Authors.
Package pubsub ...
Copyright 2018 The Elasticshift Authors.
Index ¶
- Constants
- Variables
- func NewGraphqlWSHandler(engine Engine, loggr logger.Loggr) http.Handler
- type Connection
- type ConnectionSubscriptions
- type Consumer
- type ConsumerConfig
- type Consumers
- type CosumerHandleFunc
- type Engine
- type EventHandler
- type Message
- type NSQConfig
- type Producer
- type PushResponseFunc
- type Subscription
- type SubscriptionHandler
- type SubscriptionRequest
- type SubscriptionResponse
- type Subscriptions
- type WebsocketMessage
Constants ¶
View Source
const ( // CONCURRENCY .. // max concurreny the listener should be CONCURRENCY = 200 )
Variables ¶
View Source
var (
SubscribeBuildUpdate = "subscribe_build_update"
)
subscription query names
Functions ¶
Types ¶
type Connection ¶
type Connection interface {
ID() string
PushData(id string, response *SubscriptionResponse)
PushError(err error)
PushSubscriptionError(id string, err []error)
}
Connection ..
type ConnectionSubscriptions ¶
type ConnectionSubscriptions map[string]*Subscription
ConnectionSubscriptions ..
type ConsumerConfig ¶
type ConsumerConfig struct {
NSQConfig NSQConfig
HandlerFunc CosumerHandleFunc
Topic string
Channel string
}
ConsumerConfig ..
type Consumers ¶
type Consumers interface {
Schema(schema *graphql.Schema)
Add(topic string, s *Subscription) error
Remove(topic string, s *Subscription)
}
type Engine ¶
type Engine interface {
Producer() (Producer, error)
Consumers() Consumers
SubscriptionHandler() SubscriptionHandler
Publish(topic string, payload interface{}) error
Schema(schema *graphql.Schema)
}
Engine ..
type EventHandler ¶
type EventHandler struct {
Subscribe func(Connection, string, *SubscriptionRequest) []error
Unsubscribe func(Connection, string)
Close func(Connection)
}
EventHandler ..
type Message ¶
type Message struct {
//nsq.Message
Topic string `json:"topic,omitempty"` // topic to publish or consume, as well as subscription name
Payload interface{} `json:"payload,omitempty"`
}
Message ..
type NSQConfig ¶
type NSQConfig struct {
Consumer struct {
Address string
Config *nsq.Config
}
Producer struct {
Address string
Config *nsq.Config
}
}
NSQConfig ..
type Subscription ¶
type Subscription struct {
ID string
Query string
Variables map[string]interface{}
OperationName string
Conenction Connection
Push PushResponseFunc
Topic string
OperationID string
}
Subscription ..
type SubscriptionHandler ¶
type SubscriptionHandler interface {
Subcribe(Connection, *Subscription) []error
UnsubscribeAll(Connection)
Unsubscribe(Connection, *Subscription)
Subscriptions() Subscriptions
Schema(schema *graphql.Schema)
}
SubscriptionHandler ..
func NewSubscriptionHandler ¶
func NewSubscriptionHandler(loggr logger.Loggr, cons Consumers) SubscriptionHandler
NewSubscriptionHandler ..
type SubscriptionRequest ¶
type SubscriptionRequest struct {
OperationName string `json:"operation_name,omitempty"`
Query string `json:"query,omitempty"`
Variables map[string]interface{} `json:"variables,omitempty"`
}
SubscriptionRequest ..
type SubscriptionResponse ¶
type SubscriptionResponse struct {
Data interface{} `json:"data"`
Errors []error `json:"errors"`
}
SubscriptionResponse ..
type WebsocketMessage ¶
type WebsocketMessage struct {
ID string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Payload interface{} `json:"payload,omitempty"`
}
WebsocketMessage ..
func (WebsocketMessage) String ¶
func (msg WebsocketMessage) String() string
Click to show internal directories.
Click to hide internal directories.