Documentation ¶
Index ¶
Constants ¶
View Source
const ( // CTXSubscribeTopic is the constant string that represents the subscribe function in context CTXSubscribeTopic = "subscription-subscribe-function" // CTXGraphQLWSID is the constant string that represents the websocket connection id in context CTXGraphQLWSID = "graphql-ws-id" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Notifier ¶
type Notifier interface { // Subscribes the specified function from topic Subscribe(topic string, cb func(data map[string]interface{})) // Unsubscribes the specified function from topic Unsubscribe(topic string, cb func(data map[string]interface{})) // Notify notifies the topic with the optional data Notify(topic string, data map[string]interface{}) }
Notifier is a interface used for pub-sub like interactions
type SubscriptionHandler ¶
type SubscriptionHandler struct {
// contains filtered or unexported fields
}
func MakeSubscriptionHandler ¶
func MakeSubscriptionHandler(notifier Notifier, schema graphql.Schema) *SubscriptionHandler
func (*SubscriptionHandler) ServeHTTP ¶
func (sh *SubscriptionHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*SubscriptionHandler) SetCheckOrigin ¶
func (sh *SubscriptionHandler) SetCheckOrigin(fn func(r *http.Request) bool)
Click to show internal directories.
Click to hide internal directories.