Skip to content

Commit 32d4a4c

Browse files
committed
Do not expose set_pong_message on WinRT
1 parent 218b965 commit 32d4a4c

File tree

2 files changed

+23
-18
lines changed

2 files changed

+23
-18
lines changed

Release/include/cpprest/ws_msg.h

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,16 @@ class websocket_outgoing_message
7373
{
7474
public:
7575

76-
/// <summary>
77-
/// Sets a the outgoing message to be an unsolicited pong message.
78-
/// This is useful when the client side wants to check whether the server is alive.
79-
/// </summary>
80-
void set_pong_message()
81-
{
82-
this->set_message_pong();
83-
}
76+
#if !defined(__cplusplus_winrt)
77+
/// <summary>
78+
/// Sets a the outgoing message to be an unsolicited pong message.
79+
/// This is useful when the client side wants to check whether the server is alive.
80+
/// </summary>
81+
void set_pong_message()
82+
{
83+
this->set_message_pong();
84+
}
85+
#endif
8486

8587
/// <summary>
8688
/// Sets a UTF-8 message as the message body.
@@ -161,13 +163,15 @@ class websocket_outgoing_message
161163

162164
const pplx::task_completion_event<void> & body_sent() const { return m_body_sent; }
163165

166+
#if !defined(__cplusplus_winrt)
164167
void set_message_pong()
165168
{
166-
concurrency::streams::container_buffer<std::string> buffer("");
169+
concurrency::streams::container_buffer<std::string> buffer("");
167170
m_msg_type = websocket_message_type::pong;
168171
m_length = static_cast<size_t>(buffer.size());
169172
m_body = buffer;
170173
}
174+
#endif
171175

172176
void set_message(const concurrency::streams::container_buffer<std::string> &buffer)
173177
{

Release/tests/functional/websockets/client/send_msg_tests.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -471,24 +471,25 @@ TEST_FIXTURE(uri_address, send_stream_binary_msg_no_length)
471471
client.close().wait();
472472
}
473473

474+
#if !defined(__cplusplus_winrt)
474475
// Send an unsolicited pong message to the server
475476
TEST_FIXTURE(uri_address, send_pong_msg)
476477
{
477-
test_websocket_server server;
478-
websocket_client client;
479-
send_pong_msg_helper(client, m_uri, server).wait();
480-
client.close().wait();
478+
test_websocket_server server;
479+
websocket_client client;
480+
send_pong_msg_helper(client, m_uri, server).wait();
481+
client.close().wait();
481482
}
482483

483484
// Send an unsolicited pong message to the server with websocket_callback_client
484485
TEST_FIXTURE(uri_address, send_pong_msg_callback_client)
485486
{
486-
test_websocket_server server;
487-
websocket_callback_client client;
488-
send_pong_msg_helper(client, m_uri, server).wait();
489-
client.close().wait();
487+
test_websocket_server server;
488+
websocket_callback_client client;
489+
send_pong_msg_helper(client, m_uri, server).wait();
490+
client.close().wait();
490491
}
491-
492+
#endif
492493

493494
} // SUITE(send_msg_tests)
494495

0 commit comments

Comments
 (0)