clientpool

package
v0.0.0-...-13248b8 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleNewConnection

func HandleNewConnection(subwayLine string, stopID string, conn *websocket.Conn)

HandleNewConnection Function

func Init

func Init()

Init Function

Types

type Client

type Client struct {
	UUID       uuid.UUID
	Pool       *Pool
	Conn       *websocket.Conn
	Send       chan []*gtfs.TripUpdate_StopTimeUpdate
	StopID     string
	SubwayLine string
	Config     types.Config
	Fetching   bool
}

Client struct holds all client related data

func (*Client) ConfigureGenerator

func (client *Client) ConfigureGenerator()

ConfigureGenerator is also probably overkill

func (*Client) ConfigureSort

func (client *Client) ConfigureSort()

ConfigureSort is probably really over kill but this lets you write special parsers/sorters serverside and apply them to multiple clients at once. Eventaully use an enum/constant for the sort configurations/functions. Can probably use this to return custom data types i.e. mixing train times and service alert information.

type Message

type Message struct {
	Message types.UpcomingTrain //Confusing naming convention
	Client  *Client
}

Message Struct

type Pool

type Pool struct {
	SubwayLine           string
	Clients              map[uuid.UUID]*Client
	Broadcast            chan []*gtfs.TripUpdate_StopTimeUpdate
	Register             chan *Client
	Unregister           chan *Client
	ActiveTrains         map[string][]map[uuid.UUID]*Client
	ActiveTrainChannel   chan string
	CachedStopTimeUpdate map[string][]*gtfs.TripUpdate_StopTimeUpdate
	Ticker               *time.Ticker
	Done                 chan bool
}

Pool struct holds all pool related data

type PoolMap

type PoolMap struct {
	Mutex sync.RWMutex
	Map   map[string]*Pool
}

PoolMap Struct

var Pools PoolMap

Pools Map

func (*PoolMap) DeletePool

func (p *PoolMap) DeletePool(subwayLine string)

DeletePool function

Jump to

Keyboard shortcuts

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