No Java Documentation on RxJava Schedulers and Threading
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
### Describe the bug
There is no documentation or references on what thread the SignalR Core code runs on and if the client needs to manage threading. We have implement as shown below but need clarification on:
1. If we need to specify with Rx scheduler to use for subscriptions and observations
2. What thread will the onClosed callbacks be called on. From what we see, it is run on the OkHttp thread.
### To Reproduce
We have implemented the library but subscribing `start(), invoke() and stop()` on the `Schedulers.io()` while observing on `AndroidSchedulers.mainThread()` where needed. Not sure if this is correct or even needed but it was done to ensure network activity is performed on a background thread.
The above also lets us ensure that our logic runs on the Main thread but the `onClosed` callback still runs on the `OkHttp thread.
```
onClosed { e ->
if (e == null) {
LogUtils.d(TAG, "Connection closed")
} else {
LogUtils.logMessageAndReportException(
TAG,
"createHubConnection()",
"Connection closed",
e
)
}
LogUtils.d(TAG, "Current thread: ${Thread.currentThread()}")
}
```
prints out `Current thread: Thread[OkHttp https://platform-sr.service.signalr.net/...,5,main]`
### Further technical details
- Java Client 5.0.3
- Android Studio 4.1.2
Contributor guide
Assessment
This issue has not been assessed yet.