get push stream in response send by server push with OkHttp - android

I am trying to test the push response from a server which support HTTP2 Server with an android app (Os=Android KitKat) . The server push another ressources(pictures) after a http request for index.html.
I don't know how to access to push stream (picture). I have done capture on server and it send the push stream. But the client (Okhttp 2.1.0) always send a frame RST_STREAM and just return the index page content .
I just start use okhttp and would like to know how to acces push stream from Okhttpclient response ? I have read that that it exist API for handle push stream from HTTP2. is it available in Okhttp 2.1.0 or Okhttp 2.2.0?
Thanks.

OkHttp doesn't implement pushed streams yet. When we do, it'll likely be to push into the cache only.

Related

EOFException after server responds

I have a quite simple problem but I've still couldn't find a solution yet.
What I want to accomplish:
I'm trying to establish a reliable connection between a smartphone running Android and the ESP8266 wifi module. I would like to send short HTTP string messages, where the phone plays the role of a client and the ESP8266 of a server. For managing HTTP requests I'm using the Volley library.
What already works:
I am able to do a successful HTTP GET request to the ESP8266 from a browser running on the Android phone. I also managed to use Volley to make a GET request to a server running on the web.
What doesn't work:
On the other hand, I cannot successfully send a GET request to ESP8266 using Volley. To be more precise, I get an EOFException when the server (ESP8266) tries to close the connection after it has responded. When using a browser the body of the response gets displayed after the connection is closed but in case of Volley the connection closing fails and shuts down the server.
I have no idea how to solve this problem/bug. What frustrates me is that the same commands for sending a HTTP response on the ESP work well when using a web browser but fail when using Volley. So I guess the problem is something about Volley.
Any ideas why Volley throws such exception? Any help would be deeply appreciated.

Widevine android framework DrmInfoRequest send as HTTP POST

When I use the widevine android framework and I try to call DrmInfoRequest I need it to send it as a HTTP POST and it keeps sending it as a HTTP GET requet, is there anyway to change this behavior (any parameter to set in the call, configuration)?
I have to have it as a POST for my server.
After a lock of fidgeting we ended up putting some data in the payload and this made it send it as POST.

SignalR Android and Headers

I used to use HTTP Headers to pass some authentication data from my SignalR Client (Android) to our SignalR.
After updating my project to use the lastest source from GitHub, this technique has stopped working.
After some research, I noted that this happens because the new default transport used is websocket, and websocket donĀ“t allow us to use Http Headers.
So,
Is there any way to use HTTP Headers with SignalR and WebSockets transport?
If no, how could I pass some parameters to my server? Is there any other option available than using QueryStrings?
Thanks!
In general you should be able to set headers in the client and it should send them to the server when the websocket is being opened (the connect request). Not sure what client you use but this this is possible when for sure with C# client. However, as opposed to other transports, sending or receiving messages when using websockets does not require creating new HTTP requests and therefore if you set headers after the websocket is opened they won't be sent to the server until the next time the client has to send an HTTP request which is either when the client needs to reconnect or when the connection is stopped.
Another option (if your client does not support headers for websockets) is to send parameters using query string. On the server side you can get the request using the HubCallerContext.Request property which allows you accessing the query string like this (you can also read cookies the same way):
Context.Request.QueryString
Again, query string will only be sent to the server if the client is making an HTTP request, which in case of websockets after the connection is established happens when the connection is reconnecting or is being stopped.
Finally, you already have a connection to the server so maybe you can just send your parameters using this connection which should work regardless of the transport you are using.

Http Client for cloud-to-device

Hello I write application for Android with push notification, I read documentation and there client is only for server with XMPP protocol, http://developer.android.com/google/gcm/client.html. I write application such will get data from server(time to start alarm) and it is not nessecary to do feedback. Do you have examples of HTTP client for cloud-to-device?
The client code in the link you posted works for both XMPP connection server and HTTP connection server. The only difference is that for HTTP server you can't use the GoogleCloudMessaging.send method (called by the onClick method), because that method sends a message from device to cloud.
The handling of the registration to GCM and incoming cloud to device messages is the same for both server implementations.
Our Http application server (cloud to device) is just an api call to an end point. This api call can be done in many ways, One is https://github.com/mseshachalam/GCMMessage-MultiCURL

Check HTTP request against reliable server

In my android app i keep getting timeouts in the messages between the app and my server.
In an attempt to see if the problem is in the app or my server,
i want to try and Send an HTTP request from my app to
some other server i am sure is up and reliable and then see if i get timeouts.
Is there any server address i can check against?
Thanks in advance!
BTW : i am using a glass Fish servlet for my server
We've successfully sent a simple HTTP GET to google.com -- with a couple of fall-backs (I've also seen internic.org used) in the past, in similar cases.

Categories

Resources