X Tutup
The Wayback Machine - https://web.archive.org/web/20201201011220/https://github.com/microsoft/cpprestsdk/issues/1484
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't connect to Apple push notification service with ws_client. #1484

Open
sargishayrapetyan opened this issue Aug 18, 2020 · 0 comments
Open

Can't connect to Apple push notification service with ws_client. #1484

sargishayrapetyan opened this issue Aug 18, 2020 · 0 comments

Comments

@sargishayrapetyan
Copy link

@sargishayrapetyan sargishayrapetyan commented Aug 18, 2020

I get the following error when trying to connect to APNS with connect function
terminate called after throwing an instance of 'web::websockets::client::websocket_exception' what(): set_fail_handler: 7: End of File

The source is:
`#include
#include <cpprest/ws_client.h>

using namespace web;
using namespace web::websockets::client;
using namespace web::websockets;

int main()
{
websocket_client_config lConfig;
lConfig.set_ssl_context_callback([&](boost::asio::ssl::context& aCtx)
{
aCtx.set_options( boost::asio::ssl::context::default_workarounds);
aCtx.use_certificate_file("../certificates/certificate.pem", boost::asio::ssl::context::pem);
aCtx.use_private_key_file("../certificates/private_key.pem", boost::asio::ssl::context::pem);
});

websocket_client m_client(lConfig);
//after connect I get error "End of file."
m_client.connect(U("wss://gateway.sandbox.push.apple.com:2195")).wait();

websocket_outgoing_message msg;
std::string body_str("Push Notification");
msg.set_utf8_message(body_str);
m_client.send(msg).wait();
m_client.close().wait();

}
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.
X Tutup