You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have 3 live queries subscribed simultaneously. Each of them subscribes on a different class. The following one is not working correctly somehow. The query is for live chatting and shall trigger when a message was created from a user that is for you. Right here, do not question the data model and why we do not have a channel to point to or to point from. The query for live chatting looks like:
ParseUser currentUser = ParseUser.getCurrentUser(); // this one is not null and is available on server
ParseUser participant = ...; // this one is a valid ParseUser != currentUser
ParseLiveQueryClient liveQueryClient = ParseLiveQueryClient.Factory.getClient(new OkHttp3SocketClientFactory(new OkHttpClient()));
ParseQuery<Message> queryMessages;
queryMessages = Message.getQuery();
queryMessages.whereEqualTo("receiver", currentUser).whereEqualTo("sender", participant); // sender is my chat contact
SubscriptionHandling<Message> subscriptionHandling;
subscriptionHandling = liveQueryClient.subscribe(queryMessages);
subscriptionHandling.handleEvent(SubscriptionHandling.Event.CREATE, new SubscriptionHandling.HandleEventCallback<Message>() {
@Override
public void onEvent(ParseQuery<Message> query, Message message) {
// saving message to local database
}
});
The query has two constraints.
I am receiver and
sender is my chat contact. Both are user pointers.
We have also tried seperating both constraints like:
queryMessages.whereEqualTo("receiver", currentUser);
queryMessages.whereEqualTo("sender", participant); // sender is my chat contact
but that did not work either.
Then we have tried to use one pointer only and a phonenumber as String like:
String phoneNumber = currentUser.getUsername(); // username is the users phonenumber
queryMessages.whereEqualTo("phoneNumber", phoneNumber).whereEqualTo("sender", participant);// sender is my chat contact
Somehow this is working fine. I only receive messages I should to.
What is the technical difference behind the few queries?
Another aspect I want to ask for is ParseLiveQueryClients attributes. The "clientID" is unique but the "requestID" is always 1. Watch log output:
What is requestID used for and why is it always 1?
Thank you very much
UPDATE
After testing we have found out that using 2 attributes of same date type (String, Pointer, aso.) will cause errors. We have tested with two Strings and two pointers. With one pointer and one string it works well.
Not working: (Pointer, Pointer)
queryMessages.whereEqualTo("receiver", currentUser);
queryMessages.whereEqualTo("sender", participant); // sender is my chat contact
and (String, String)
queryMessages.whereEqualTo("receiver", currentUser.getUsername());
queryMessages.whereEqualTo("sender", participant.getUsername()); // sender is my chat contact
Working: (String, Pointer)
queryMessages.whereEqualTo("receiver", currentUser.getUsername());
queryMessages.whereEqualTo("owner", participant);// sender is my chat contact
The text was updated successfully, but these errors were encountered:
ghost
changed the title
LiveQuery with two pointers of same type does not work
LiveQuery with two objects of same data type does not work
May 10, 2017
ghost
changed the title
LiveQuery with two objects of same data type does not work
LiveQuery with two objects of same data type does not work [UPDATED]
May 10, 2017
Hi,
We have 3 live queries subscribed simultaneously. Each of them subscribes on a different class. The following one is not working correctly somehow. The query is for live chatting and shall trigger when a message was created from a user that is for you. Right here, do not question the data model and why we do not have a channel to point to or to point from. The query for live chatting looks like:
The query has two constraints.
We have also tried seperating both constraints like:
but that did not work either.
Then we have tried to use one pointer only and a phonenumber as String like:
Somehow this is working fine. I only receive messages I should to.
What is the technical difference behind the few queries?
Another aspect I want to ask for is ParseLiveQueryClients attributes. The "clientID" is unique but the "requestID" is always 1. Watch log output:
What is requestID used for and why is it always 1?
Thank you very much
UPDATE
After testing we have found out that using 2 attributes of same date type (String, Pointer, aso.) will cause errors. We have tested with two Strings and two pointers. With one pointer and one string it works well.
Not working: (Pointer, Pointer)
and (String, String)
Working: (String, Pointer)
The text was updated successfully, but these errors were encountered: