Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] History: Payload had to be []bytes #432

Merged
merged 1 commit into from
Sep 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions internal/service/history/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/emitter-io/emitter/internal/provider/logging"
"github.com/emitter-io/emitter/internal/security"
"github.com/emitter-io/emitter/internal/service"
"github.com/kelindar/binary"
)

// Request represents a historical messages request.
Expand All @@ -33,8 +34,8 @@ type Request struct {

type Message struct {
ID message.ID `json:"id"`
Topic string `json:"topic"` // The channel of the message
Payload string `json:"payload"` // The payload of the message
Channel string `json:"channel"` // The channel of the message
Payload []byte `json:"payload"` // The payload of the message
}
type Response struct {
Request uint16 `json:"req,omitempty"` // The corresponding request ID.
Expand Down Expand Up @@ -87,8 +88,8 @@ func (s *Service) OnRequest(c service.Conn, payload []byte) (service.Response, b
msg := m
resp.Messages = append(resp.Messages, Message{
ID: msg.ID,
Topic: string(msg.Channel), // The channel for this message.
Payload: string(msg.Payload), // The payload for this message.
Channel: binary.ToString(&msg.Channel),
Payload: msg.Payload,
})
}
return resp, true
Expand Down
Loading