Skip to content

Commit

Permalink
parse more fields for message event struct
Browse files Browse the repository at this point in the history
  • Loading branch information
the-newman committed Jul 18, 2024
1 parent fa10343 commit 27d18ce
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
22 changes: 15 additions & 7 deletions events.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,16 @@ type HeartbeatEvent struct {

// MessageEvent is receive message event.
type MessageEvent struct {
PersistentID string `json:"persistentId"`
From string `json:"from"`
To string `json:"to"`
TTL int32 `json:"ttl"`
Sent int64 `json:"sent"`
Data []byte `json:"data"`
PersistentID string `json:"persistentId"`
From string `json:"from"`
To string `json:"to"`
TTL int32 `json:"ttl"`
Sent int64 `json:"sent"`
AppData []*pb.AppData `json:"app_data"`
Token string `json:"token"`
RegID string `json:"reg_id"`
RawData []byte `json:"raw_data"`
AppID string `json:"app_id"`
}

func newMessageEvent(data *pb.DataMessageStanza) *MessageEvent {
Expand All @@ -57,7 +61,11 @@ func newMessageEvent(data *pb.DataMessageStanza) *MessageEvent {
To: data.GetTo(),
TTL: data.GetTtl(),
Sent: data.GetSent(),
Data: data.GetRawData(),
AppData: data.GetAppData(),
Token: data.GetToken(),
RegID: data.GetRegId(),
RawData: data.GetRawData(),
AppID: data.GetAppID(),
}
}

Expand Down
11 changes: 11 additions & 0 deletions pb/mcs/mcs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 27d18ce

Please sign in to comment.