AS-Devs / signalr_flutter

A flutter plugin for .net SignalR client.
https://pub.dev/packages/signalr_flutter
MIT License
18 stars 28 forks source link

java.lang.IllegalStateException: Expected STRING but was BEGIN_OBJECT at path #9

Closed tayyyab closed 3 years ago

tayyyab commented 4 years ago

I get this message on HubCallBack methods. The issue only exists in the Android.

I/flutter ( 8673): java.lang.IllegalStateException: Expected STRING but was BEGIN_OBJECT at path $

_signalRCallbackHandler Throws an exception.

AyonAB commented 4 years ago

What version of the plugin are you using? If you are not using latest version then change it to the latest, which is v0.0.5 and do a flutter clean after that.

tomasgaray commented 4 years ago

i have the same issus: java.lang.IllegalStateException: Expected STRING but was BEGIN_OBJECT at path $ happen when the backend send an object.

image

another thing, can you please add a callback by every subscribe HubMethod , cause sometimes, we need to specific thing by callback thanks so much

AyonAB commented 4 years ago

Although I'm little confused as why StatusChangeCallback is raising this exception cause it was meant to be String. I couldn't quite reproduce the issue but anyway did some changes for a possible fix. @tayyyab or @tomasgaray if any one of you can grab the latest pre-release version (0.0.6-dev.1) from the pub and test it, I'll be glad for that help.

itsthetaste commented 4 years ago

yes I can confirm that this is working for me now. I can now receive objects.

But as tomas says, there is no way to tell which of the HubMethods triggered the hubCallback.

AyonAB commented 4 years ago

Thank you for the feedback and as for the hubCallBack, I'll looking into it once I get some time.

furkansoylemez commented 2 years ago

im getting this exception when server sends a json. Its ok with receiving strings but im in trouble with jsons. Any suggestions? @AyonAB

Edit: I fixed this issue by changing in kotlin code hub.on method class type String to Object and casted received object to string.I can open pull request if its ok