rwc

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: AGPL-3.0, AGPL-3.0 Imports: 7 Imported by: 0

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
	File      string
}

Client represents a client for sending outgoing messages

func (*Client) RelayIn

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

RelayIn relays from websocket server to the hub until stopped

func (*Client) RelayOut

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

RelayOut relays 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)
}

Hub represents a messaging hub

func New

func New(messages *agg.Hub) *Hub

New returns a pointer to a new Hub pass in the messaging hub as a parameter assume it is already running

func (*Hub) Run

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

Run starts the Hub

type Rule

type Rule struct {
	ID          string `json:"id"`
	Stream      string `json:"stream"`
	Destination string `json:"destination"`
	Token       string `json:"token"`
	File        string `json:"file"`
}

Rule represents a rule for outgoing messages

Jump to

Keyboard shortcuts

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