19 lines
568 B
Go
19 lines
568 B
Go
package seatlist
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
stdio "git.novox.be/novox/mesh-sdk/go"
|
|
)
|
|
|
|
type stdioBus struct{}
|
|
|
|
// StdioBus is the bus a bundle has: the runtime's ask and subscribe over its pipe. Call Start once Serve runs.
|
|
func StdioBus() Bus { return stdioBus{} }
|
|
|
|
func (stdioBus) Ask(key string, body any) (json.RawMessage, error) { return stdio.Ask(key, body) }
|
|
|
|
func (stdioBus) Subscribe(pattern string, handle func(key string, body json.RawMessage) error) error {
|
|
return stdio.Subscribe(pattern, func(e stdio.Envelope) error { return handle(e.Key, e.Body) })
|
|
}
|