server

package module
v0.0.0-...-852fca6 Latest Latest
Warning

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

Go to latest
Published: May 16, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenAndServe

func ListenAndServe(addr string, url string, auth string) error

ListenAndServe starts the server.

func NewRedisPool

func NewRedisPool() *redis.Pool

NewRedisPool from env.

func Serve

func Serve(hub *Hub, w http.ResponseWriter, r *http.Request)

Serve handles websocket requests from the peer.

Types

type Hub

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

Hub maintains the set of active clients and broadcasts messages to the clients.

func NewHub

func NewHub(url string, auth string) *Hub

NewHub ...

func (*Hub) Auth

func (h *Hub) Auth() string

func (*Hub) Run

func (h *Hub) Run()

Run hub.

type Redis

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

Redis ...

func NewRedis

func NewRedis(hub *Hub) *Redis

NewRedis ...

func (*Redis) Delete

func (r *Redis) Delete(ctx context.Context, k string) error

Delete value.

func (*Redis) Expire

func (r *Redis) Expire(ctx context.Context, k string, dt time.Duration) error

Expire value.

func (*Redis) Get

func (r *Redis) Get(ctx context.Context, k string) (string, error)

Get value.

func (*Redis) Increment

func (r *Redis) Increment(ctx context.Context, k string) (int64, error)

Increment value.

func (*Redis) Set

func (r *Redis) Set(ctx context.Context, k string, v string) error

Set value.

func (*Redis) Subscribe

func (r *Redis) Subscribe() error

Subscribe ...

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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