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

PingPong Client feature #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

osbarciela
Copy link

@osbarciela osbarciela commented Nov 6, 2024

Pull Request Description

Summary

This Pull Request introduces improvements in WebSocket connection management on the ESP32 client. Functionalities have been added to handle receiving pongs from the server.

Changes Made

  1. Added the onPong method in `WebSocketClient:

    • The onPong method has been declared and defined in WebSocketClient to handle receiving pongs from the server.
    • The onPongCallback callback signature has been corrected to match the lambda used.
  2. Handling PONG frames in WebSocket::

    • In WebSocket.cpp, a case has been added to handle frames of type PONG_FRAME and call the _onPing callback.

Modified Files

  • WebSocketClient.h:
    void onPong(const onPingCallback &);
  • WebSocketClient.cpp:
    void WebSocketClient::onPong(const onPingCallback &callback) {
      _onPing = callback;
    }
  • WebSocket.cpp:
    case Opcode::PONG_FRAME: {
      if (_onPing) {
        _onPing(*this, payload, header.length);
      }
      break;
    }

Tests Performed

  • It has been verified that the client receives pongs from the server and calls the _onPing callback.

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.

1 participant