i' am studing Flow but i don/t have example of rea...
# coroutines
g
i' am studing Flow but i don/t have example of real use now.. ok i can use some public api but i need some continous stream to try operator, zip, merge.. etc. How can use or find some data stream.. such as a socket?
t
Why not start by building a data generator yourself? For instance, you could write a microservice that polls the temperature of your region from an external service, but generates a continuous stream of events from it.
I mean, this could be extremely simple, like:
Copy code
val sock = socket.accept()
while (socket has not closed) {
  val t = getTemperatureFromServer()
  writeToSocket(sock, newTempMessage(t))
}
e
https://kotlinlang.org/docs/coroutines-and-channels.html walkthrough uses the github api, and there's a lot to explore there