Skip to content

Document which thread is whole SDK or callbacks using #800

@qsdigor

Description

@qsdigor

As we all know there are different threads in java, they usually differentiate into one main thread and many background threads.

It looks like SDK is using background threads to do network work and returns results on background threads. This is good as it won't block apps and can run async. Network stuff is done on WebSocketConnectReadThread thread.

The issue is usually on android apps as they tend to change UI after receiving presence updates or get messages. Our background thread does not support UI updates like changing some texts or updating recycler view adapters.

We have multiple options:

  • Change the thread to main when returning the results. This will increase complexity and introduce bugs.
  • Implement an option to allow users to select a thread of their choice.
  • Document usage of background threads and point out that all work is done on background tread, for UI changes please use the main thread.

I would recommend the third option as a simpler and better option. This won't break any apps or cause implementation issues as the code won't change.

┆Issue is synchronized with this Jira Story by Unito

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to public interface documentation (API reference or readme).

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions