Only the first request works
See original GitHub issueHi! I’m trying to use HttpTwo with APNS (development server). Any first request (POST, Connect, Ping) is processed successfully, but, after that, any other request except Disconnect fails with error of broken connection from the remote party.
var store = new X509Store("MY", StoreLocation.CurrentUser);
Http2Client request2 = null;
try
{
store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
var myCert =
store.Certificates.Find(X509FindType.FindBySubjectName, "Apple Development IOS Push Services", false)
.OfType<X509Certificate2>()
.FirstOrDefault();
//var uri = new Uri("https://api.development.push.apple.com");
var path =
new Uri(
"https://api.development.push.apple.com/3/device/somedeviceId");
request2 = new Http2Client(path, myCert != null ? new X509Certificate2Collection(myCert) : null);
store.Close();
var stream1 = new MemoryStream();
var notif = new Notification {Aps = new Aps {Alert = "Hello", Sound = "default"}};
var ser = new DataContractJsonSerializer(typeof (Notification));
ser.WriteObject(stream1, notif);
stream1.Position = 0;
var response = await request2.Send(path, HttpMethod.Post, null, stream1);
Every new request in the same process (even made with new Http2Client instance) is refused by server. What do I do wrong?
Issue Analytics
- State:
- Created 7 years ago
- Comments:8
Top Results From Across the Web
Only first request works in bouncy - node.js - Stack Overflow
We are using a node.js script based on bouncy to manage a lot of small tools we run. It proxies the traffic to...
Read more >An overview of HTTP - MDN Web Docs
HTTP is a protocol for fetching resources such as HTML documents. It is the foundation of any data exchange on the Web and...
Read more >Sending your first request - Postman Learning Center
Sending your first request. Postman enables you to create and send API requests. Send a request to an endpoint, retrieve data from a...
Read more >How the web works: HTTP and CGI explained
A web server is a just a computer program that listens for requests from browsers ... The first thing the browser has to...
Read more >HTTP Request Methods – Get vs Put vs Post Explained with ...
You'll also have experience making requests and working with a web API ... only job is to listen continuously for a request to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello! I spent couple of days, trying to make this lib working. Core problems of this lib:
This will be enought for working solution.
Performance also is very pure, but it’s much easyer: change Lists to byte arrays in Frames.
Are there any solutions yet? I have the same problem firing more than one request to the Server. For example the first Post Command: 11:09:06.326 PM: -> [Frame: SETTINGS, Id=0, Ack=False, HeaderTableSize=, EnablePush=, MaxConcurrentStreams=, InitialWindowSize=, MaxFrameSize=, MaxHeaderListSize=] 11:09:06.332 PM: <- [Frame: SETTINGS, Id=0, Ack=False, HeaderTableSize=, EnablePush=, MaxConcurrentStreams=, InitialWindowSize=, MaxFrameSize=, MaxHeaderListSize=] 11:09:06.348 PM: -> [Frame: SETTINGS, Id=0, Ack=True, HeaderTableSize=, EnablePush=, MaxConcurrentStreams=, InitialWindowSize=, MaxFrameSize=, MaxHeaderListSize=] 11:09:06.355 PM: -> [Frame: HEADERS, Id=1, EndStream=False, EndHeaders=True, Priority=False, Weight=0, Padded=False, PadLength=0, HeaderBlockFragmentLength=144] 11:09:06.357 PM: -> [Frame: DATA, Id=1, EndStream=True, Padded=False, PadLength=0, PayloadLength=96] 11:09:06.499 PM: <- [Frame: SETTINGS, Id=0, Ack=True, HeaderTableSize=, EnablePush=, MaxConcurrentStreams=, InitialWindowSize=, MaxFrameSize=, MaxHeaderListSize=] 11:09:06.519 PM: <- [Frame: HEADERS, Id=1, EndStream=False, EndHeaders=True, Priority=False, Weight=0, Padded=False, PadLength=0, HeaderBlockFragmentLength=37] 11:09:06.520 PM: <- [Frame: DATA, Id=1, EndStream=True, Padded=False, PadLength=0, PayloadLength=27] 11:09:06.533 PM: -> [Frame: WINDOW_UPDATE, Id=0, WindowSizeIncrement=27] 11:09:06.540 PM: -> [Frame: GOAWAY, Id=0, ErrorCode=0, LastStreamId=0, AdditionalDebugData=]
This is a connection to Apple Push Notification Service. The Server sends me a goaway frame. But why?
The next post request looks like this:
11:09:29.147 PM: <- [Frame: SETTINGS, Id=0, Ack=False, HeaderTableSize=, EnablePush=, MaxConcurrentStreams=, InitialWindowSize=, MaxFrameSize=, MaxHeaderListSize=] 11:09:29.149 PM: -> [Frame: SETTINGS, Id=0, Ack=True, HeaderTableSize=, EnablePush=, MaxConcurrentStreams=, InitialWindowSize=, MaxFrameSize=, MaxHeaderListSize=] 11:09:29.150 PM: -> [Frame: SETTINGS, Id=0, Ack=False, HeaderTableSize=, EnablePush=, MaxConcurrentStreams=, InitialWindowSize=, MaxFrameSize=, MaxHeaderListSize=] 11:09:29.150 PM: -> [Frame: HEADERS, Id=1, EndStream=False, EndHeaders=True, Priority=False, Weight=0, Padded=False, PadLength=0, HeaderBlockFragmentLength=144] 11:09:29.150 PM: -> [Frame: DATA, Id=1, EndStream=True, Padded=False, PadLength=0, PayloadLength=96] 11:09:29.311 PM: <- [Frame: GOAWAY, Id=0, ErrorCode=1, LastStreamId=0, AdditionalDebugData=First received frame was not SETTINGS. Hex dump for first 5 bytes: 0000000401]