centrifugal / centrifuge-dart

Dart (Flutter) client SDK for bidirectional communication with Centrifugo and Centrifuge-based server over WebSocket
https://pub.dartlang.org/packages/centrifuge
MIT License
102 stars 29 forks source link

I can't connect(setToken) #68

Closed furkanerkl closed 1 year ago

furkanerkl commented 1 year ago

ErrorEvent{error: Connect error: ClientDisconnectedError}

I am getting this error. I think the problem is that I can't assign the token properly. How can I use the setToken command like in JS. Also how can I make 'debug:true' as in the code below.

const centrifuge = new Centrifuge('url', { websocket: WebSocket, debug: true });

enesuludg commented 1 year ago

I have same problem

FZambia commented 1 year ago

Hello

Could you share server and Dart SDK versions? Note that:

The latest centrifuge-dart is compatible only with the latest Centrifugo server (v4) and Centrifuge >= 0.25.0. For Centrifugo v2, Centrifugo v3 and Centrifuge < 0.25.0 you should use centrifuge-dart v0.8.0.

setToken method not available in the latest Dart SDK, to work with tokens you need to use token and getToken configuration options - see example. This SDK now works according to this spec.

furkanerkl commented 1 year ago

@FZambia As you said, the problem was solved when I changed the library version to v0.8.0.

FZambia commented 1 year ago

Awesome, closing then. @enesuludg hopefully you have same issue, if not please open a new one with server/client versions and steps to reproduce