diff --git a/main.go b/main.go index 1d77b85..93c28b8 100644 --- a/main.go +++ b/main.go @@ -16,7 +16,7 @@ func main() { fmt.Println(nodeInfo) // Submitting some message. - // messages.SubmitMessage(nodeURL, "LB_REPLY", "{asdfghjkl}", 15) + // messages.SubmitMessage(nodeURL, "LB_REPLY", "{asdfghjkl}", 15) // TODO: Conseguir ler esse tipo de mensagem // Reading some messages by an index. messages := messages.GetAllMessagesByIndex(nodeURL, "LB_REPLY") diff --git a/messages/getAllMessagesByIndex.go b/messages/getAllMessagesByIndex.go index 3c8167c..9e2c2f3 100644 --- a/messages/getAllMessagesByIndex.go +++ b/messages/getAllMessagesByIndex.go @@ -76,6 +76,11 @@ func formatMessagePayload(message iotago.Message) Message { } else { log.Panic("Unexpected array length.") } + } else if strings.Contains(payloadInString, "\t") { + payloadTemp := strings.Split(payloadInString, "\t") + + index = payloadTemp[0] + content = payloadTemp[1] } else { log.Fatal("Malformed payload.") }