diff options
author | 2023-03-11 02:10:58 -0800 | |
---|---|---|
committer | 2023-03-11 11:10:58 +0100 | |
commit | e323a930bff2c3a7d6b591e0bdcd092a5ed60f18 (patch) | |
tree | d0c1e408a908a43c256eef7a79e8909abab1b9a0 /internal/processing/stream/open.go | |
parent | [frontend/fix] Mobile css tweaks (#1605) (diff) | |
download | gotosocial-e323a930bff2c3a7d6b591e0bdcd092a5ed60f18.tar.xz |
[feature] Support multiple subscriptions on single websocket connection (#1489)
- Allow Oauth authentication on websocket endpoint
- Make streamType query parameter optional
- Read websocket commands from client and update subscriptions
Diffstat (limited to 'internal/processing/stream/open.go')
-rw-r--r-- | internal/processing/stream/open.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/internal/processing/stream/open.go b/internal/processing/stream/open.go index 10d01a767..823efa182 100644 --- a/internal/processing/stream/open.go +++ b/internal/processing/stream/open.go @@ -45,9 +45,17 @@ func (p *Processor) Open(ctx context.Context, account *gtsmodel.Account, streamT return nil, gtserror.NewErrorInternalError(fmt.Errorf("error generating stream id: %s", err)) } + // Each stream can be subscibed to multiple timelines. + // Record them in a set, and include the initial one + // if it was given to us + timelines := map[string]bool{} + if streamTimeline != "" { + timelines[streamTimeline] = true + } + thisStream := &stream.Stream{ ID: streamID, - Timeline: streamTimeline, + Timelines: timelines, Messages: make(chan *stream.Message, 100), Hangup: make(chan interface{}, 1), Connected: true, |