parseCallbacks parses the message's "callbacks" field and prepares callback functions in "arguments" field.
(msg *Message, sender func(id uint64, args []interface{}) error)
| 76 | // parseCallbacks parses the message's "callbacks" field and prepares |
| 77 | // callback functions in "arguments" field. |
| 78 | func ParseCallbacks(msg *Message, sender func(id uint64, args []interface{}) error) error { |
| 79 | // Parse callbacks field and create callback functions. |
| 80 | for methodID, path := range msg.Callbacks { |
| 81 | id, err := strconv.ParseUint(methodID, 10, 64) |
| 82 | if err != nil { |
| 83 | return err |
| 84 | } |
| 85 | |
| 86 | f := func(args ...interface{}) error { return sender(id, args) } |
| 87 | spec := CallbackSpec{path, Function{functionReceived(f)}} |
| 88 | msg.Arguments.CallbackSpecs = append(msg.Arguments.CallbackSpecs, spec) |
| 89 | } |
| 90 | |
| 91 | return nil |
| 92 | } |
nothing calls this directly
no test coverage detected