gqlwsclient

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*Config
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cfg *Config) *Client

func (*Client) Close

func (c *Client) Close()

func (*Client) Error

func (c *Client) Error() error

func (*Client) Subscribe

func (c *Client) Subscribe(payload gqlwsmessage.SubscribePayload, handlers Handlers) func()

returns unsubscribe function

func (*Client) Wait

func (c *Client) Wait()

type Config

type Config struct {
	URL                  string
	ConnectionAckTimeout time.Duration
	GraceClosePeriod     time.Duration
	// maximum retry attempts before a connection is established
	ReconnectAttempts uint32
	// OnConnecting called on connection init
	// returns the payload to send in the init request
	OnConnecting        func() interface{}
	OnPing              func(*gqlwsmessage.Message) interface{}
	OnPong, OnConnected func(*gqlwsmessage.Message)
}

type Handlers

type Handlers struct {
	OnError    func(gqlerrors.FormattedErrors)
	OnComplete func()
	OnNext     func(*graphql.Result)
}

Jump to

Keyboard shortcuts

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