Stephan Schuster
10/12/2021, 9:48 AMMikolaj Leszczynski
10/12/2021, 10:23 AMsuspend fun Flow<X>
being returned from your data layers. Could you satisfy my curiosity? 🙂Stephan Schuster
10/12/2021, 10:54 AMfun
for VM and suspend fun
for the data layers. The Flow<X>
are meant to be the thick upward lines/streams on the right. I took this visualization more or less from the android docs regarding flow. Of course, there is no suspend fun Flow<X>
.Mikolaj Leszczynski
10/12/2021, 10:57 AMsuspend fun
or Flow<X>
, yes?Stephan Schuster
10/12/2021, 11:10 AMmiqbaldc
10/12/2021, 11:31 AMMikolaj Leszczynski
10/12/2021, 11:34 AMStephan Schuster
10/12/2021, 12:18 PMMikolaj Leszczynski
10/12/2021, 12:20 PMStephan Schuster
10/12/2021, 12:23 PMMikolaj Leszczynski
10/12/2021, 1:15 PMSam
10/30/2021, 8:41 PMDefault
= Dispatchers.Unconfine and Usually
= Dispatchers.Default ?
I think we can use only 2 kind of dispatchers:
1. Dispatchers.Main for UI
2. Dispatchers.IO for API, database..etc
Thanks/Stephan Schuster
11/01/2021, 8:49 AMDispatchers.Default
. If you want to switch context to <http://Dispatchers.IO|Dispatchers.IO>
, you have to do this manually or rely on the implicit behavior of e.g. Room or Retrofit which both do this for you automatically.
Does that make sense?Mikolaj Leszczynski
11/01/2021, 9:06 AMSam
11/01/2021, 9:44 AMSender
Step 1: User A send a message “Hello worlds”
Step 2: Activity will call a viewmodel to send a message -> it will go through these threads -> Main (click a button) -> IO ( call API ) -> Default (Send a state Success/Error) -> Main (Show a alert to UI )
Receiver
Step 1: Socket IO will listen and receive a message -> we have to setup Socket IO in Activity
Step 2: Socket IO will receive a message ( Im not sure which thread it will come from - Ref https://socket.io/blog/native-socket-io-and-android/ )
Step 3: ViewModel will receive a message from SocketIO -> it will go through these threads -> another thread from Android UI thread
to receiving a message-> IO ( save Room ) -> Default ( Send a state Success/Error ) -> Main ( add to recyclerview)
is it correct ways?Stephan Schuster
11/01/2021, 1:17 PM