signalr

package
v0.0.0-...-ed7ff26 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RECEIVE_SERVER_MESSAGE = "ReceiveServerMessage"
	RECEIVE_AIRPORT_UPDATE = "ReceiveAirportUpdate"
	RECEIVE_PIREP          = "ReceivePirep"
)

Variables

This section is empty.

Functions

func AirportHook

func AirportHook(old, new airports.Airport)

func PIREPHook

func PIREPHook(pirep *pireps.PIREP)

Types

type IDSHub

type IDSHub struct {
	signalr.Hub
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, r chi.Router, as *airports.AirportService, cs *charts.ChartService, ps *pireps.PIREPService) (*IDSHub, error)

func (*IDSHub) ConfigureHooks

func (h *IDSHub) ConfigureHooks(airportService *airports.AirportService, pirepService *pireps.PIREPService)

func (*IDSHub) OnConnected

func (h *IDSHub) OnConnected(connectionID string)

We setup a clients table in our Handler which tracks connectionID to CID already

func (*IDSHub) OnDisconnected

func (h *IDSHub) OnDisconnected(connectionID string)

func (*IDSHub) SendAirportUpdate

func (h *IDSHub) SendAirportUpdate(connectionID string, old, new airports.Airport)

func (*IDSHub) SendPirep

func (h *IDSHub) SendPirep(connectionID string, pirep *pireps.PIREP)

func (*IDSHub) SendServerMessage

func (h *IDSHub) SendServerMessage(connectionID string, message string)

Helpers for sending messages to clients

func (*IDSHub) SubmitPIREP

func (h *IDSHub) SubmitPIREP(pirep json.RawMessage)

func (*IDSHub) UpdateAirport

func (h *IDSHub) UpdateAirport(id string, patch json.RawMessage) json.RawMessage

type Logger

type Logger struct{}

func (*Logger) Log

func (l *Logger) Log(keyvals ...interface{}) error

Wrapper for zerolog

type SignalRHandler

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

func NewHandler

func NewHandler(router chi.Router, server signalr.Server) *SignalRHandler

func (*SignalRHandler) FindClientByConnectionId

func (h *SignalRHandler) FindClientByConnectionId(connectionID string) string

func (*SignalRHandler) HandleGet

func (h *SignalRHandler) HandleGet(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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