Skip to content

Commit fcbab87

Browse files
committed
push-api: refreshes auth token upon reconnect
1 parent 5715042 commit fcbab87

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

push.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,12 @@ func (a *client) messageReadLoop(subscriptionID uuid.UUID, series chan<- SeriesM
132132
if closeErr, ok := err.(*websocket.CloseError); ok {
133133
log.Printf("[INFO]: Websocket was closed, starting reconnect loop. Reason='%s'\n", closeErr.Error())
134134

135-
// TODO: make sure to generate a new access token as the original one may be too old
135+
authErr := a.authenticate()
136+
if authErr != nil {
137+
errors <- fmt.Errorf("%v", authErr)
138+
return
139+
}
140+
136141
err = a.PushServiceConnect(subscriptionID)
137142
if err != nil {
138143
errors <- err
@@ -165,7 +170,7 @@ func (a *client) messageReadLoop(subscriptionID uuid.UUID, series chan<- SeriesM
165170
continue
166171
}
167172

168-
s.Raw = string(message)
173+
s.Raw = message
169174
series <- s
170175
}
171176

structs/push.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type SeriesMessage struct {
2222
Message
2323
CreatedTimestamp int64 `json:"created_timestamp"`
2424
Payload SeriesPayload `json:"payload"`
25-
Raw string `json:"-"`
25+
Raw []byte `json:"-"`
2626
}
2727

2828
type Diff struct {

0 commit comments

Comments
 (0)