Documentation
¶
Index ¶
- Constants
- func FindRunningSocket(appName string) (string, error)
- func FindRunningSocketAny(appNames ...string) (string, error)
- type Capabilities
- type Client
- type Config
- type ConnWriter
- type Event
- type EventBus
- type Handler
- type Mux
- type PendingOpen
- type Request
- type Response
- type Server
- type Subscriber
Constants ¶
const PendingTopic = "ui"
PendingTopic is the topic PendingOpen publishes on.
Variables ¶
This section is empty.
Functions ¶
func FindRunningSocket ¶
func FindRunningSocketAny ¶
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) Respond ¶
func (w *ConnWriter) Respond[T any](id int, result T)
func (*ConnWriter) RespondError ¶
func (w *ConnWriter) RespondError(id int, msg string)
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 PendingOpen ¶
type PendingOpen struct {
// contains filtered or unexported fields
}
PendingOpen holds "ui" actions that arrived before the UI subscribed, so a cold start still honors them.
func (*PendingOpen) Deliver ¶
func (p *PendingOpen) Deliver(bus *EventBus, payload map[string]any)
Deliver publishes payload now when the UI listens and nothing is queued ahead of it, otherwise queues it.
func (*PendingOpen) Flush ¶
func (p *PendingOpen) Flush(bus *EventBus)
Flush publishes everything queued, in order.
func (*PendingOpen) Take ¶
func (p *PendingOpen) Take() []map[string]any
Take empties the queue and returns what it held, for a caller that answers with it instead of publishing.
type Request ¶
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)
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package spec describes an app's IPC methods for `describe`, `ipc list` and shell completion, and parses the `ipc <method> key=value...` command line into request params.
|
Package spec describes an app's IPC methods for `describe`, `ipc list` and shell completion, and parses the `ipc <method> key=value...` command line into request params. |