MCPcopy
hub / github.com/IceWhaleTech/CasaOS / SendNotify

Method SendNotify

service/notify.go:55–70  ·  view source on GitHub ↗
(name string, message map[string]interface{})

Source from the content-addressed store, hash-verified

53}
54
55func (i *notifyServer) SendNotify(name string, message map[string]interface{}) {
56 msg := make(map[string]string)
57 for k, v := range message {
58 bt, _ := json.Marshal(v)
59 msg[k] = string(bt)
60 }
61 response, err := MyService.MessageBus().PublishEventWithResponse(context.Background(), common.SERVICENAME, name, msg)
62 if err != nil {
63 logger.Error("failed to publish event to message bus", zap.Error(err), zap.Any("event", msg))
64 return
65 }
66 if response.StatusCode() != http.StatusOK {
67 logger.Error("failed to publish event to message bus", zap.String("status", response.Status()), zap.Any("response", response))
68 }
69 // SocketServer.BroadcastToRoom("/", "public", path, message)
70}
71
72// Send periodic broadcast messages
73func (i *notifyServer) SendFileOperateNotify(nowSend bool) {

Callers

nothing calls this directly

Calls 2

MessageBusMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected