wshub

package
v0.0.0-...-86a089b Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2019 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package wshub provides a websocket server and client using gorilla/websocket for package hub.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*websocket.Dialer
	TokenProvider
	Log log.Logger
	// contains filtered or unexported fields
}

func NewClient

func NewClient(url string) *Client

func (*Client) Chan

func (c *Client) Chan() chan<- *hub.Msg

func (*Client) Connect

func (c *Client) Connect(r chan<- *hub.Msg) error

func (*Client) ID

func (c *Client) ID() int64

type Server

type Server struct {
	*hub.Hub
	*websocket.Upgrader
	Log log.Logger
}

func (*Server) HandleHTTP

func (s *Server) HandleHTTP(w http.ResponseWriter, r *http.Request)

type TokenProvider

type TokenProvider interface {
	Token(url string) (http.Header, error)
	ClearToken(url string) error
}

Jump to

Keyboard shortcuts

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