-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
getting transport error on connect. #71
Comments
Hello @Tunmise-Adegoke How you are running it? Is it for web? (this sdk does not work for web at the moment, see open issue #34) |
I see in the mobile logs that Centrifuge client successfully connected to the server and got unauthorized reason for subscription. Is that SocketException you observe raises from inside centrifuge-dart library? Or maybe its unrelated? |
I think it's from centrifugo because that's the only websocket on the app. |
Can you check this? It may be from any other network activity I suppose - nothing in the exception says it's coming from the WebSocket. What's happening with the WebSocket connection after this error occurs btw? |
The websockets disconnects. I'm making some other network calls though but I don't think it should affect it. But the websocket disconnects after a minute. |
If WebSocket disconnects a minute after being established this may be your proxy configuration which does not allow long-lived connections. So it may simply be a separate thing. You may be right that the error comes from Centrifuge-dart. Or may be not. Since you have the reproducer you have all the power to check it. Or submit minimal reproducing steps without your app specifics so I could also take a closer look. |
OMG, do you think I can run your screenshots? Post the reproducing code (minimal, without your app specifics) as a repo on Github, give me instructions how to run it. |
Hello, This is a link to the repo I created |
Hello @Tunmise-Adegoke Thanks for posting example, I managed to run it for both MacOS desktop app and in Android emulator. In both cases it works without any issues. And WebSocket connection not closed at all. Here is an output when running in Android emulator:
|
@Tunmise-Adegoke any updates? do you see a different output when running on your machine? Have you tried to update flutter to the latest version? |
Hello@FZambia, I gave you an unlimited token which works perfectly on my own end too. I'm have been trying to generate a token from my api to test it. I have been getting errors so that's why I haven't replied since. |
Hello @FZambia, as seen in your screenshot, your event was unsubscribed for unauthorised reasons. I'm facing the same issue. Please do you know the reason? |
Yes, the reason is that the code uses dummy getToken for Subscription: https://github.com/Tunmise-Adegoke/centrifugo_project/blob/f39da4727641f48e0b5b0d87b60ee6b0e8cffffb/lib/client/client.dart#L55 Instead of: final subscription = client.newSubscription(
channel,
centrifuge.SubscriptionConfig(
getToken: (centrifuge.SubscriptionTokenEvent event) {
return Future.value('');
},
),
); You should use whether: final subscription = client.newSubscription(
channel,
centrifuge.SubscriptionConfig(),
); Or load subscription token properly (now returning I can't say exactly which way you need – depends on server permission configuration. |
I tired another method apart from this and it worked. I can connect and subscribe with ease. |
Closing – as far as I understand all is good here. BTW, centrifuge-dart SDK will also support web in the next release - was just added in #73 . |
Yay! For web.Thank you |
I tried connecting to a remote centrifugo deployment using the code above and got the error below,
I want to add that this is the version of the dart package I'm using centrifuge: ^0.9.2 and the version of the remote deployment is 4.1.2
The text was updated successfully, but these errors were encountered: