Documentation
¶
Index ¶
Constants ¶
const PlatformID = "local"
PlatformID is the platform identifier for the local chat platform.
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 broadcasts replies to connected SSE clients via SSEHub.
func NewLocalSender ¶
func NewLocalSender(hub *SSEHub) *LocalSender
NewLocalSender constructs a LocalSender.
func (*LocalSender) Send ¶
func (s *LocalSender) Send(ctx context.Context, msg platform.OutboundMessage) error
Send broadcasts the reply to any connected SSE clients for the session. The session key is read from msg.ReplyTo.SessionKey.
type SSEHub ¶
type SSEHub struct {
// contains filtered or unexported fields
}
SSEHub manages Server-Sent Events subscriptions keyed by session key.