mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-01 05:42:25 -05:00
[feature] support Sec-Websocket-Protocol in streaming API (#1254)
* [feature] support Sec-Websocket-Protocol in streaming API * Fix lint problem * Update based on reviews
This commit is contained in:
parent
69dd5fed2c
commit
d10388cc28
3 changed files with 255 additions and 4 deletions
|
|
@ -131,7 +131,10 @@ func (m *Module) StreamGETHandler(c *gin.Context) {
|
|||
|
||||
accessToken := c.Query(AccessTokenQueryKey)
|
||||
if accessToken == "" {
|
||||
err := fmt.Errorf("no access token provided under query key %s", AccessTokenQueryKey)
|
||||
accessToken = c.GetHeader(AccessTokenHeader)
|
||||
}
|
||||
if accessToken == "" {
|
||||
err := fmt.Errorf("no access token provided under query key %s or under header %s", AccessTokenQueryKey, AccessTokenHeader)
|
||||
api.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGet)
|
||||
return
|
||||
}
|
||||
|
|
@ -171,7 +174,7 @@ func (m *Module) StreamGETHandler(c *gin.Context) {
|
|||
close(stream.Hangup)
|
||||
}()
|
||||
|
||||
streamTicker := time.NewTicker(30 * time.Second)
|
||||
streamTicker := time.NewTicker(m.tickDuration)
|
||||
|
||||
// We want to stay in the loop as long as possible while the client is connected.
|
||||
// The only thing that should break the loop is if the client leaves or the connection becomes unhealthy.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue