func NewSubscriptionManager(schema *graphql.Schema) SubscriptionManager {
	return newSubscriptionManager(schema, NewLogger("subscriptions"))
}
NewSubscriptionManager creates a new subscription manager.
package graphqlws
import (
	"errors"
	"github.com/graphql-go/graphql"
	"github.com/graphql-go/graphql/gqlerrors"
	"github.com/graphql-go/graphql/language/ast"
	"github.com/graphql-go/graphql/language/parser"
	log "github.com/sirupsen/logrus"
)
func ErrorsFromGraphQLErrors(errors []gqlerrors.FormattedError) []error {
	if len(errors) == 0 {
		return nil
	}
	out := make([]error, len(errors))
	for i := range errors {
		out[i] = errors[i]
	}
	return out
}
type SubscriptionSendDataFunc func(*DataMessagePayload)
type Subscription struct {
	ID            string
	Query         string
	Variables     map[string]interface{}
	OperationName string
	Document      *ast.Document
	Fields        []string
	Connection    Connection
	SendData      SubscriptionSendDataFunc
}
func (s *Subscription) MatchesField(field string) bool {
	if s.Document == nil || len(s.Fields) == 0 {
		return false
	}
	for _, name := range s.Fields {
		if name == field {
			return true
		}
	}
	return false
}
type ConnectionSubscriptions map[string]*Subscription
type Subscriptions map[Connection]ConnectionSubscriptions
type SubscriptionManager interface {
	Subscriptions() Subscriptions
	AddSubscription(Connection, *Subscription) []error
	RemoveSubscription(Connection, *Subscription)
	RemoveSubscriptions(Connection)
}
type subscriptionManager struct {
	subscriptions Subscriptions
	schema        *graphql.Schema
	logger        *log.Entry
}
func NewSubscriptionManagerWithLogger(schema *graphql.Schema, logger *log.Entry) SubscriptionManager {
	return newSubscriptionManager(schema, logger)
}