Implemented addRule api but I have problem with streaming one. This is my streaming api:
@Streaming
@GET("search/stream")
suspend fun getTweets(): ResponseBody
// suspend fun getTweets(): Observable<TweetResponse>
// suspend fun getTweets(): TweetResponse
Tries all 3 ways but neither works. With the uncommented way (one with ResponseBody), I get the response in my repository class.
But standard mapping from json to object:
var responseBody = it
val jsonString = responseBody.string()
val gson = Gson()
val myObject = gson.fromJson(jsonString, TweetResponse::class.java)
does not work. To be more precise, it fails at the line:
responseBody.string()
with error: "Method threw 'java.net.SocketTimeoutException' exception."
I never worked before with streaming APIs, this API can not be tested in Postman or Insomnia. When i shoot Curl of this API in terminal, it just shoots enormous amount of Tweets, they just keep coming. Maybe this is the thing that confuses my mapping to objects, but can't be sure.
Feels like I am literally missing 1-2 lines of code to make this work. Any help please :D?