MCPcopy
hub / github.com/tinode/chat / Init

Function Init

server/push/push.go:139–158  ·  view source on GitHub ↗

Init initializes registered handlers.

(jsconfig json.RawMessage)

Source from the content-addressed store, hash-verified

137
138// Init initializes registered handlers.
139func Init(jsconfig json.RawMessage) ([]string, error) {
140 var config []configType
141
142 if err := json.Unmarshal(jsconfig, &config); err != nil {
143 return nil, errors.New("failed to parse config: " + err.Error())
144 }
145
146 var enabled []string
147 for _, cc := range config {
148 if hnd := handlers[cc.Name]; hnd != nil {
149 if ok, err := hnd.Init(cc.Config); err != nil {
150 return nil, err
151 } else if ok {
152 enabled = append(enabled, cc.Name)
153 }
154 }
155 }
156
157 return enabled, nil
158}
159
160// Push a single message to devices.
161func Push(msg *Receipt) {

Callers 1

mainFunction · 0.92

Calls 2

ErrorMethod · 0.80
InitMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…