Skip to content

Commit

Permalink
[IMP] Adds a Status (200) field to Me and Presence response for consi…
Browse files Browse the repository at this point in the history
…stency
  • Loading branch information
Florimond committed Sep 24, 2024
1 parent 74e6649 commit 21d0c19
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/service/me/me.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ func (s *Service) OnRequest(c service.Conn, payload []byte) (service.Response, b
}

return &Response{
ID: c.ID(),
Links: links,
Status: 200,
ID: c.ID(),
Links: links,
}, true
}
1 change: 1 addition & 0 deletions internal/service/me/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package me
// Response represents a response for the 'me' request.
type Response struct {
Request uint16 `json:"req,omitempty"` // The corresponding request ID.
Status int `json:"status"` // The status of the response
ID string `json:"id"` // The private ID of the connection.
Links map[string]string `json:"links,omitempty"` // The set of pre-defined channels.
}
Expand Down
1 change: 1 addition & 0 deletions internal/service/presence/presence.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func (s *Service) OnRequest(c service.Conn, payload []byte) (service.Response, b
// Gather local & cluster presence
who = append(who, s.getAllPresence(ssid)...)
return &Response{
Status: 200,
Time: now,
Event: EventTypeStatus,
Channel: msg.Channel,
Expand Down
1 change: 1 addition & 0 deletions internal/service/presence/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const (
// Response represents a state notification.
type Response struct {
Request uint16 `json:"req,omitempty"` // The corresponding request ID.
Status int `json:"status"` // The status of the response
Time int64 `json:"time"` // The UNIX timestamp.
Event EventType `json:"event"` // The event, must be "status", "subscribe" or "unsubscribe".
Channel string `json:"channel"` // The target channel for the notification.
Expand Down

0 comments on commit 21d0c19

Please sign in to comment.