ServicePattern / MobileAPI_Android

Messaging API library and example for Android mobile platform
1 stars 1 forks source link

Receiving same message with same timestamp 70 times per second #34

Closed bramley-stride closed 3 years ago

bramley-stride commented 3 years ago

The new endpoint is no longer timing out, but is sending Android the same initial message over 70 times per second.

{"events":[{"channel":"web","event":"chat_session_message","msg":"If you know your case number please enter it now. You may also reply New to open a new case.","msg_id":"0","party_id":"55362A42-59E2-440D-BAEA-1DA0A4C3AEE3","timestamp":"1620641128"}]}

These values are always the same, even the timestamp. Therefore I suppose the problem is in the Android library?

Sample logs:

2021-05-10 20:10:03.905 21935-21935/au.com.webjet.dev E/S_DELIVERED: OK
2021-05-10 20:10:03.905 21935-21935/au.com.webjet.dev E/S_READ: OK
2021-05-10 20:10:03.921 21935-21935/au.com.webjet.dev E/S_DELIVERED: OK
2021-05-10 20:10:03.921 21935-21935/au.com.webjet.dev E/S_READ: OK
2021-05-10 20:10:03.937 21935-21935/au.com.webjet.dev E/S_DELIVERED: OK
2021-05-10 20:10:03.938 21935-21935/au.com.webjet.dev E/S_READ: OK
2021-05-10 20:10:03.954 21935-21935/au.com.webjet.dev E/S_DELIVERED: OK
2021-05-10 20:10:03.954 21935-21935/au.com.webjet.dev E/S_READ: OK
2021-05-10 20:10:03.970 21935-21935/au.com.webjet.dev E/S_DELIVERED: OK
2021-05-10 20:10:03.971 21935-21935/au.com.webjet.dev E/S_READ: OK
2021-05-10 20:10:03.986 21935-21935/au.com.webjet.dev E/S_DELIVERED: OK
2021-05-10 20:10:03.986 21935-21935/au.com.webjet.dev E/S_READ: OK
2021-05-10 20:10:04.003 21935-21935/au.com.webjet.dev E/S_DELIVERED: OK
2021-05-10 20:10:04.004 21935-21935/au.com.webjet.dev E/S_READ: OK

It looks like there's a pretty tight loop here where runObservation() calls the API, gets the result, then calls runObservation() again: image

The constant updating even breaks the chatkit library/recyclerview, causing these two messages to draw on top of each other: image

ALobastov commented 3 years ago

Duplicate of https://bugfocus.zendesk.com/agent/tickets/30398. Still in research but definitely server side issue; not the library. Reported by iOS team with the same endpoint.

ALobastov commented 3 years ago

Looks like the issue is with Nginx which is caching the requests and responds on the poll requests with the last result.

First of all, the caching should be disabled in the nginx configuration; BP support is working with TTec on this.

Second, we might change the library to overcome caching, but this is long shot and will take time.

ALobastov commented 3 years ago

Per latest update, the Nginx configuration has been corrected which should have fixed the issue. Please confirm and close.

ALobastov commented 3 years ago

No response, considering fixed, closing.