Documentation
¶
Index ¶
- func FindRunningSocket(appName string) (string, error)
- func Respond[T any](w *ConnWriter, id int, result T)
- func RespondError(w *ConnWriter, id int, msg string)
- type Capabilities
- type Client
- type Config
- type ConnWriter
- type Event
- type EventBus
- type Handler
- type Mux
- type Request
- type Response
- type Server
- type Subscriber
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindRunningSocket ¶
func Respond ¶
func Respond[T any](w *ConnWriter, id int, result T)
func RespondError ¶
func RespondError(w *ConnWriter, id int, msg string)
Types ¶
type Capabilities ¶
type Config ¶
type Config struct {
AppName string
APIVersion int
Capabilities []string
CapabilitiesFunc func() []string // computed per connection; overrides Capabilities when set
MaxLineSize int
DefaultSubscribeTopics []string
OnSubscribe func(topics []string, sub *Subscriber)
SubscribeHandler Handler // replaces the built-in subscribe/unsubscribe handling when set
Bus *EventBus
}
type ConnWriter ¶
type ConnWriter struct {
// contains filtered or unexported fields
}
func NewConnWriter ¶
func NewConnWriter(conn net.Conn) *ConnWriter
func (*ConnWriter) WriteEvent ¶
func (w *ConnWriter) WriteEvent(ev Event) error
func (*ConnWriter) WriteResponse ¶
func (w *ConnWriter) WriteResponse(resp any) error
type EventBus ¶
type EventBus struct {
// contains filtered or unexported fields
}
func NewEventBus ¶
func NewEventBus() *EventBus
func (*EventBus) HasSubscriber ¶
func (*EventBus) NewSubscriber ¶
func (b *EventBus) NewSubscriber(ctx context.Context, writer *ConnWriter) *Subscriber
type Handler ¶
type Handler func(ctx context.Context, w *ConnWriter, req Request, sub *Subscriber)
type Mux ¶
type Mux struct {
// contains filtered or unexported fields
}
func (*Mux) HandlePrefix ¶
func (*Mux) ServeIPC ¶
func (m *Mux) ServeIPC(ctx context.Context, w *ConnWriter, req Request, sub *Subscriber)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) SocketPath ¶
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
func (*Subscriber) Close ¶
func (s *Subscriber) Close()
func (*Subscriber) Subscribe ¶
func (s *Subscriber) Subscribe(topics ...string)
func (*Subscriber) Topics ¶
func (s *Subscriber) Topics() []string
func (*Subscriber) Unsubscribe ¶
func (s *Subscriber) Unsubscribe(topics ...string)
Click to show internal directories.
Click to hide internal directories.