title: Okhttp multiple response handling for single request android
body: <p>I have an android application and I am trying to make an http/2 call with okHttp version 3.13.1, in my case for one request I will be receiving two responses sequentially from the server, but with the okHttp client I am getting only one response and if I try to send the request using curl command I am receiving two responses sequentially from the server.</p>
  
  <p>Is there a way to handle multiple responses for a single http/2 request in android?</p>
  
  <p>I tried various ways, but no luck:( Would be more than happy, if anyone could provide your inputs.</p>
  
  <p>Thanks for your help and time in advance!!!</p>
  
  <p>I am basically sending a get request from my android application using okHttp client to a server which supports http/2, so expecting to receive 2 different response for that single request in a timely manner.i.e the second response will be sent from the server after 5 seconds gap of receiving the first response.</p>
  
  <p>Below is my response :</p>
  
  <p><strong>First response</strong>
  event:initialize</p>
  
  <pre><code>{"session_id":"df313001-6461-431c-bcc1-7cb931bda4f5","deviceId":"YL0012345678"}
  </code></pre>
  
  <p><strong>Second response</strong>
  event:voice_response
  data:<code>{"intents":[{"version":0,"intent":"telstra_intent_voice","params":{"voiceResponse":{"displayText":"Launching now","vuiFileName":"E03.01.P2.V01.E.wav"},"action":{"ecp":"/launch-install/71361"}}}],"deviceId":"YL0012345678","channelId":"269671"}</code></p>
  
  <p>But, in my case once I receive the first response the client is no longer listing to the server. When I receive the first response, in my log I see :
  com.example.okhttp3 D/OkHttp: &lt;-- END HTTP (166-byte body),
  so not receiving the second response.</p>
  
  <p>Appreciate your help!</p>