gss

package module
v0.0.0-...-cdde9b2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2018 License: MIT Imports: 13 Imported by: 0

README

graphqlws-subscription-server

this project is work in progress

Documentation

Overview

Package gss is a web server using GraphQL over WebSocket Protocol: https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md

See README.md for more info.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNotifyHandler

func NewNotifyHandler(ch chan *RequestData) http.Handler

func NewSubscribeFilter

func NewSubscribeFilter() *subscribeFilter

Types

type CanSendToUserFunc

type CanSendToUserFunc func(conn *graphqlws.Connection, reqData *RequestData) bool

type ChannelSerializer

type ChannelSerializer interface {
	Serialize(field string, args QueryArgsMap) string
}

type GraphQLContextKey

type GraphQLContextKey string

type NotificationHandler

type NotificationHandler struct {
	// contains filtered or unexported fields
}

func (*NotificationHandler) ServeHTTP

func (h *NotificationHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

type NotificationResponse

type NotificationResponse struct {
	Success bool     `json:"success"`
	Errors  []string `json:"errors"`
}

type QueryArgsMap

type QueryArgsMap map[string]string

type RequestData

type RequestData struct {
	Users   []string    `json:"users"`
	Channel string      `json:"channel"`
	Payload interface{} `json:"payload"`
}

func NewRequestDataFromBytes

func NewRequestDataFromBytes(b []byte) (*RequestData, error)

func (*RequestData) Validate

func (d *RequestData) Validate() error

type SubscribeFilter

type SubscribeFilter interface {
	RegisterConnectionIDFromDocument(connID string, subID string, doc *ast.Document, variables map[string]interface{})
	RemoveSubscriptionIDFromConnectionID(connID, subID string)
	RemoveConnectionIDFromChannels(connID string)
	GetChannelRegisteredConnectionIDs(channel string) SubscriptionIDByConnectionID
}

type SubscribeService

type SubscribeService struct {
	graphqlws.SubscriptionManager
	Schema *graphql.Schema
	Pool   graphqlws.SubscriptionManager
	Filter SubscribeFilter
	// contains filtered or unexported fields
}

func NewSubscribeService

func NewSubscribeService(schema *graphql.Schema, c CanSendToUserFunc) *SubscribeService

func (*SubscribeService) AddSubscription

func (s *SubscribeService) AddSubscription(conn graphqlws.Connection, sub *graphqlws.Subscription) []error

func (*SubscribeService) NewSubscriptionHandler

func (s *SubscribeService) NewSubscriptionHandler(authCallback graphqlws.AuthenticateFunc) http.Handler

func (*SubscribeService) Publish

func (s *SubscribeService) Publish(reqData *RequestData)

func (*SubscribeService) RemoveSubscription

func (s *SubscribeService) RemoveSubscription(conn graphqlws.Connection, sub *graphqlws.Subscription)

func (*SubscribeService) RemoveSubscriptions

func (s *SubscribeService) RemoveSubscriptions(conn graphqlws.Connection)

func (*SubscribeService) Subscriptions

func (s *SubscribeService) Subscriptions() graphqlws.Subscriptions

type SubscriptionIDByConnectionID

type SubscriptionIDByConnectionID map[string]string

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL