client

package
v0.0.0-...-9ca37e5 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiClient

type ApiClient interface {
	// Include the API interface definition
	api.Api

	// Connect wraps wwrclt.Client.Connect
	Connect() error

	// Close wraps wwrclt.Client.Close
	Close()

	// Session wraps wwrclt.Client.Session
	Session() *wwr.Session

	// Identifier returns the identifier of the client.
	// Returns nil if this client is an unauthenticated guest client
	Identifier() *api.Identifier

	Query(
		ctx context.Context,
		method api.Method,
		params interface{},
		result interface{},
	) error
}

ApiClient represents an API client

func New

func New(
	srvAddr string,
	opts wwrclt.Options,
	hooks Hooks,
) ApiClient

New constructs a new API client instance

type Hooks

type Hooks struct {
	OnSessionCreated func(*wwr.Session)
	OnSessionClosed  func()
	OnDisconnected   func()
	OnSignal         func(wwr.Payload)
}

Hooks represents the hook functions used for hookable API client events

Jump to

Keyboard shortcuts

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