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

Add unsolicited pong support with integration tests #20

Closed
wants to merge 1 commit into from

Conversation

glukacsy
Copy link

Hi,

This is the same as my previous pull request, but now I added integration tests.

I added unsolicited pong support to Casablanca (see https://tools.ietf.org/html/rfc6455#section-5.5.3). This is useful for cases when the client wants to check whether the websocket connection is still up and running. For example, if I unplug my network cable, without this change, Casablanca simply does not notice that the Websocket connection is down, the close handler won't get invoked etc.

With these changes, the client can send (periodically or when certain events happen, e.g. network change events) an unsolicited pong request which has no effect on a healthy websocket connection, but will help Casablanca/WebSocket++ detect that the connection has been lost. With these changes, if I unplug my network cable and if I send a pong message after that, Casablanca correctly invokes the websocket close handler within a few seconds.

Regards,
Gergely

@msftclas
Copy link

Hi @glukacsy, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by Microsoft and real humans are currently evaluating your PR.

TTYL, MSBOT;

@@ -456,6 +471,25 @@ TEST_FIXTURE(uri_address, send_stream_binary_msg_no_length)
client.close().wait();
}

// Send an unsolicited pong message to the server
TEST_FIXTURE(uri_address, send_pong_msg)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests will fail on WinRT since our WinRT websocket implementation does not support ping/pong messages. We should disable these tests on winrt (#if !defined(__cplusplus_winrt)).
Alternatively, I can also disable these tests for WinRT once we accept the PR.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am happy adding the ifdef myself, but I am also happy if you do that :) Let me know how you want me to proceed.

@kavyako
Copy link
Contributor

kavyako commented Dec 2, 2015

This has been merged to development branch. I disabled the API on WinRT.

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

Successfully merging this pull request may close these issues.

4 participants