mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-03 00:42:25 -06:00
[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
This commit is contained in:
parent
cb2f84e551
commit
e323a930bf
4 changed files with 74 additions and 26 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue