Hi, really love your library ,but am currently facing an issue with the subscription connect and disconnect ,as per your example you disconnect using a button click which is located in the same block the subscription initialisation ,
However in my use case i need to unsubscribe on the OnStop lifecycle , but it seem to now work as expected , on exit and enter of activity calling the subscription call , get this error
Caused by : java.lang.IllegalStateException: closed when i called subscribe();
Subscription sub = new BaseQuery.Builder("Message")
.where("toid",toObject.getObjectId() )
.addField("fromName")
.addField("message")
.build()
.subscribe();
looking throught the source code , it seem the livequeryClient destory isnt called and cause the closed error , am currently not very good with websocket , i would really appreciate any help at all . thank you
private void executeQueryInternal(String query) {
if (webSocket != null) {
try {
webSocket.sendMessage(RequestBody.create(WebSocket.TEXT, query));
} catch (IOException e) {
e.printStackTrace();
}
}
}
AND HERE
protected static void executeQuery(BaseQuery baseQuery) {
getInstance().executeQueryInternal(baseQuery.toString());
}
AND HERE
public static void registerSubscription(Subscription subscription) {
mSubscriptions.add(subscription);
if (isConnected()) {
executeQuery(subscription.getQuery());
}
}
Hi, really love your library ,but am currently facing an issue with the subscription connect and disconnect ,as per your example you disconnect using a button click which is located in the same block the subscription initialisation ,
However in my use case i need to unsubscribe on the OnStop lifecycle , but it seem to now work as expected , on exit and enter of activity calling the subscription call , get this error
Caused by
: java.lang.IllegalStateException: closed
when i called subscribe();looking throught the source code , it seem the livequeryClient destory isnt called and cause the closed error , am currently not very good with websocket , i would really appreciate any help at all . thank you