-
-
Notifications
You must be signed in to change notification settings - Fork 604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] proxy connect with SubscribeOptions not working v5.4.4 #873
Comments
yes, a workaround method, just split subscribe to another API command ( I think) |
I think, the related code lines are: centrifugo/internal/proxy/connect_handler.go Line 132 in 60d3746
subscriptions := make(map[string]centrifuge.SubscribeOptions, len(result.Channels))
// ...
// should be changed to these
joinLeave := chOpts.JoinLeave
if result.Subs != nil {
opt := result.Subs[ch]
if opt != nil && opt.Override != nil && opt.Override.ForcePushJoinLeave != nil {
joinLeave = opt.GetOverride().GetForcePushJoinLeave().GetValue()
}
}
subscriptions[ch] = centrifuge.SubscribeOptions{
EmitPresence: chOpts.Presence,
EmitJoinLeave: chOpts.JoinLeave,
PushJoinLeave: joinLeave, // chOpts.ForcePushJoinLeave, // read directly from chOpts.ForcePushJoinLeave , subs from ConnectResponse cmd is ignored.
EnableRecovery: chOpts.ForceRecovery,
EnablePositioning: chOpts.ForcePositioning,
RecoveryMode: chOpts.GetRecoveryMode(),
Source: subsource.ConnectProxy,
HistoryMetaTTL: time.Duration(chOpts.HistoryMetaTTL),
} |
Hello @morya , Thanks for the detailed report, you are right – I see the following things to be fixed here:
One note btw, I see you are using both
You can stick to sth single here - whether only |
Alright, I use channels for this kind of response from our project, which works perfectly, until I want to customize sub options. I thought, it's should be the I will stick to I was planning open a PR, but afraid of send miss leading codes, which may lead to extra pointless review efforts. Best regards. |
just confirmed that, func doServerSubscribe(client string) {
cc := gocent.New(gocent.Config{
Addr: "http://127.0.0.1:8000/api",
Key: "fake-key",
})
err := cc.Subscribe(context.TODO(), "foo", client, gocent.WithPresence(true), gocent.WithJoinLeave(true))
if err != nil {
log.Fatalf("Server Subscribe failed %v", err)
}
} params from encoded json result is: {"method":"subscribe","params":{"channel":"foo","user":"3e3fc43b-bef9-4ab5-a3da-4c96c688351e","presence":true,"join_leave":true}} and, this will be ignored when decode from centrifugo server with SubscribeRequest require all fields inside |
Could you please open a separate issue in |
ok |
Should work correctly in v5.4.5 |
Describe the bug.
SubscribeOptions field from connect proxy response, is not working.
version: v5.4.4
Centrifugo version is
v5.4.4
Client library used is
github.com/centrifugal/centrifuge v0.33.1-0.20240801054640-96afa7258679
Operating system is
macos
Steps to Reproduce How can the bug be triggered?
with
config.yaml
for centrifugo like this:Expected behavior What output or behaviour were you expecting instead?
Code Snippets A minimum viable code snippet can be useful.
I use fastapi to be centrifugo proxy-handler.
The text was updated successfully, but these errors were encountered: