diff options
author | 2022-12-14 04:56:42 -0500 | |
---|---|---|
committer | 2022-12-14 10:56:42 +0100 | |
commit | d10388cc285f09d4d80528a6e1195e0e1997a822 (patch) | |
tree | 657db1a2d5c40be487073de7348f7cc46cac58ed /internal/api/client/streaming/streaming.go | |
parent | [feature] domain block wildcarding (#1178) (diff) | |
download | gotosocial-d10388cc285f09d4d80528a6e1195e0e1997a822.tar.xz |
[feature] support Sec-Websocket-Protocol in streaming API (#1254)
* [feature] support Sec-Websocket-Protocol in streaming API
* Fix lint problem
* Update based on reviews
Diffstat (limited to 'internal/api/client/streaming/streaming.go')
-rw-r--r-- | internal/api/client/streaming/streaming.go | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/internal/api/client/streaming/streaming.go b/internal/api/client/streaming/streaming.go index f09da4ed5..b15dfbdbd 100644 --- a/internal/api/client/streaming/streaming.go +++ b/internal/api/client/streaming/streaming.go @@ -20,6 +20,7 @@ package streaming import ( "net/http" + "time" "github.com/superseriousbusiness/gotosocial/internal/api" "github.com/superseriousbusiness/gotosocial/internal/processing" @@ -35,17 +36,29 @@ const ( // AccessTokenQueryKey is the query key for an oauth access token that should be passed in streaming requests. AccessTokenQueryKey = "access_token" + // AccessTokenHeader is the header for an oauth access token that can be passed in streaming requests instead of AccessTokenQueryKey + //nolint:gosec + AccessTokenHeader = "Sec-Websocket-Protocol" ) // Module implements the api.ClientModule interface for everything related to streaming type Module struct { - processor processing.Processor + processor processing.Processor + tickDuration time.Duration } // New returns a new streaming module func New(processor processing.Processor) api.ClientModule { return &Module{ - processor: processor, + processor: processor, + tickDuration: 30 * time.Second, + } +} + +func NewWithTickDuration(processor processing.Processor, tickDuration time.Duration) api.ClientModule { + return &Module{ + processor: processor, + tickDuration: tickDuration, } } |