Skip to content

Subscribing to Parse Live Query the first time doesn't work #61

Open
@mkpazon

Description

@mkpazon

In my activity's onResume() I am subscribing to live query

@Override
protected void onResume() {
     SubscriptionHandling<ParseObject> subscriptionHandling = mParseLiveQueryClient.subscribe(messageQuery);
     subscriptionHandling.handleEvents(new SubscriptionHandling.HandleEventsCallback<ParseObject>() {
            @Override
            public void onEvents(ParseQuery<ParseObject> query, SubscriptionHandling.Event event, ParseObject parseMessage) {
                // HANDLING all events
                Timber.d("getMessageHistory -> .onEvents");
                Timber.i(event.name());
            }
        });
}

In my logs I see the following:

V/ParseLiveQueryClient: Socket stateChanged
V/ParseLiveQueryClient: Socket stateChanged
V/ParseLiveQueryClient: Socket opened
V/ParseLiveQueryClient: Socket onMessage {"op":"connected","clientId":88}
V/ParseLiveQueryClient: Connected, sending pending subscription

No events are being caught.

When I switch to another application and go back then my onResume() is triggered again re-registering to live query. I get the following logs: (Notice that this now has the "subscribed" part)

V/ParseLiveQueryClient: Socket stateChanged
V/ParseLiveQueryClient: Socket stateChanged
V/ParseLiveQueryClient: Socket opened
V/ParseLiveQueryClient: Socket onMessage {"op":"connected","clientId":91}
V/ParseLiveQueryClient: Connected, sending pending subscription
V/ParseLiveQueryClient: Socket onMessage {"op":"subscribed","clientId":91,"requestId":1}

This now is able to receive all the events.

Howcome the first registration doesn't work while the 2nd one works?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions