func (t *TestRunner) Publish(msg sarif.Message) { if msg.Source == "" { msg.Source = t.Id } if err := t.conn.Write(msg); err != nil { t.T.Fatal(err) } }
func tableToMessage(L *lua.LState, t *lua.LTable) sarif.Message { msg := sarif.Message{} msg.Version = tableGetString(t, "sarif") msg.Id = tableGetString(t, "id") msg.Action = tableGetString(t, "action") msg.Source = tableGetString(t, "src") msg.Destination = tableGetString(t, "dest") msg.CorrId = tableGetString(t, "corr") msg.Text = tableGetString(t, "text") p := luareflect.DecodeToBasic(t.RawGetH(lua.LString("p"))) msg.EncodePayload(p) return msg }
func (cv *Conversation) PublishForClient(msg sarif.Message) { msg.Source = cv.service.DeviceId + "/" + cv.Device cv.service.Publish(msg) }