summaryrefslogtreecommitdiff
path: root/internal/api/client/streaming/streaming.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/api/client/streaming/streaming.go')
-rw-r--r--internal/api/client/streaming/streaming.go17
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,
}
}