0

This plugin ...

https://pub.dev/packages/ably_flutter

... asked me to do this ...

ably.ClientOptions options = ably.ClientOptions(
  clientId : '...',
  authUrl : '...',
  authHeaders : {'Authorization' : '...'},
);
ably.Realtime realtime = await ably.Realtime(options : options);

... before gave me this ...

E/DartMessenger(12893): Uncaught exception in binary message listener

E/DartMessenger(12893): java.lang.ClassCastException: java.util.HashMap cannot be cast to io.ably.lib.types.Param[]

... and I don't know what else to do.

I thought it's because the backend responded wrong format data to Ably, so it was failed to convert it to ably.tokenParams type at app end. But backend guys told me there's nothing wrong at their end.

Greatly appreciate your help thank you.

2
  • Hi @stackunderflow . Thanks for raising this question. I am an SDK developer at Ably and wanted to let you know that it's a bug in our side. I have created an issue on Github if you wanted to track the status : github.com/ably/ably-flutter/issues/444 Commented Oct 4, 2022 at 14:03
  • @ikbal thank you for your reply. it's great to hear from ably dev team themselves. actually i've find a workaround for this issue. i posted it as the answer for my question. thanks again Commented Oct 4, 2022 at 15:28

1 Answer 1

1

It's working either way using authCallback instead of authUrl and clientId, where TokenRequest or TokenDetais generated from data returned by back-end.

Authenticate with signed TokenRequest

ably.ClientOptions(
  key : token //Authentication token
  authCallback : (ably.TokenParams params) => ably.TokenRequest.fromMap(...)
);

Authenticate with Ably JWT

ably.ClientOptions(
  authCallback : (ably.TokenParams params) => ably.TokenDetails.fromMap(...)
);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.