rwc

package module
v0.0.0-...-00e6abe Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2019 License: AGPL-3.0 Imports: 5 Imported by: 1

README

rwc

(Re)connnects a /timdrysdale.hub stream to a dynamically reconfigurable ws endpoint

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Hub       *Hub //can access messaging hub via <client>.Hub.Messages
	Messages  *hub.Client
	Context   context.Context
	Cancel    context.CancelFunc
	Websocket *reconws.ReconWs
}

func (*Client) RelayIn

func (c *Client) RelayIn(ctx context.Context)

relay messages from websocket server to the hub until stopped

func (*Client) RelayOut

func (c *Client) RelayOut(ctx context.Context)

relay messages from the hub to the websocket client until stopped

type Hub

type Hub struct {
	Messages  *agg.Hub
	Clients   map[string]*Client //map Id string to client
	Rules     map[string]Rule    //map Id string to Rule
	Add       chan Rule
	Delete    chan string      //Id string
	Broadcast chan hub.Message //for messages incoming from the websocket server(s)
}

func New

func New(messages *agg.Hub) *Hub

pass in the messaging hub as a parameter assume it is already running

func (*Hub) Run

func (h *Hub) Run(closed chan struct{})

type Rule

type Rule struct {
	Id          string `json:"id"`
	Stream      string `json:"stream"`
	Destination string `json:"destination"`
}

Jump to

Keyboard shortcuts

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