Add StateChanged(func(map[string]interface{}), more ...string) to client and server, to watch state updates with more customized detail, e.g. "completed:result" as default, e.g. pending:next\|task\|message\|result

This commit is contained in:
mindon
2022-10-19 11:11:05 +08:00
parent c08f142b56
commit dbe886c071
4 changed files with 138 additions and 8 deletions

View File

@@ -697,3 +697,8 @@ func (srv *Server) Stop() {
srv.processor.stop()
srv.logger.Info("Processor stopped")
}
// StateChanged watch state updates, with more customized detail
func (srv *Server) StateChanged(handler func(map[string]interface{}), more ...string) error {
return srv.broker.StateChanged(handler, more...)
}