Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LocalPlatform ¶
type LocalPlatform struct {
// contains filtered or unexported fields
}
LocalPlatform bundles LocalReceiver and LocalSender and implements platform.Platform.
func NewPlatform ¶
func NewPlatform(receiver *LocalReceiver, sender *LocalSender) *LocalPlatform
NewPlatform constructs a LocalPlatform from pre-built receiver and sender.
func (*LocalPlatform) ID ¶
func (p *LocalPlatform) ID() string
func (*LocalPlatform) Receiver ¶
func (p *LocalPlatform) Receiver() platform.PlatformReceiverAdapter
func (*LocalPlatform) Sender ¶
func (p *LocalPlatform) Sender() platform.PlatformSenderAdapter
type LocalReceiver ¶
type LocalReceiver struct {
// contains filtered or unexported fields
}
LocalReceiver implements platform.PlatformReceiverAdapter. Messages are injected via Enqueue and dispatched to the registered handler in Start.
func NewLocalReceiver ¶
func NewLocalReceiver(bufSize int) *LocalReceiver
NewLocalReceiver constructs a LocalReceiver with the given channel buffer size.
func (*LocalReceiver) Enqueue ¶
func (r *LocalReceiver) Enqueue(msg platform.InboundMessage)
Enqueue adds a message to the dispatch queue. If the channel is full the message is dropped and a warning is logged.
func (*LocalReceiver) Start ¶
func (r *LocalReceiver) Start(ctx context.Context, dispatch func(platform.InboundMessage)) error
Start blocks, dispatching each enqueued message, until ctx is cancelled. Implements platform.PlatformReceiverAdapter.
type LocalSender ¶
type LocalSender struct {
// contains filtered or unexported fields
}
LocalSender implements platform.PlatformSenderAdapter. It writes bee replies to the local_replies table and broadcasts via SSEHub.
func NewLocalSender ¶
func NewLocalSender(replyStore *store.LocalReplyStore, hub *SSEHub) *LocalSender
NewLocalSender constructs a LocalSender.
func (*LocalSender) Send ¶
func (s *LocalSender) Send(ctx context.Context, msg platform.OutboundMessage) error
Send stores the reply and broadcasts it to any connected SSE clients. The session key is read from msg.ReplyTo.SessionKey (msg.SessionKey is always empty).
type SSEHub ¶
type SSEHub struct {
// contains filtered or unexported fields
}
SSEHub manages Server-Sent Events subscriptions keyed by session key.