Пример #1
0
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)
	}
}
Пример #2
0
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
}
Пример #3
0
func (cv *Conversation) PublishForClient(msg sarif.Message) {
	msg.Source = cv.service.DeviceId + "/" + cv.Device
	cv.service.Publish(msg)
}