WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Only the first request works #4

@DocVirus

Description

@DocVirus

Hi! 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions