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

[Access] Implement keepalive routine with ping-ponging to ws connection in ws controller #6639

Open
Tracked by #6163
Guitarheroua opened this issue Nov 12, 2024 · 1 comment · May be fixed by #6757
Open
Tracked by #6163
Assignees
Labels

Comments

@Guitarheroua
Copy link
Contributor

Guitarheroua commented Nov 12, 2024

Develop a separate Keepalive module for the web socket controller to monitor network availability using WebSocket ping-pong service messages.

Requirements:

  • The Keepalive module should be instantiated and managed by the web socket controller but function independently.
  • The module should operate autonomously to detect connectivity issues.
  • If issues are detected, it should:
    • Disable the WebSocket connection.
    • Trigger a graceful shutdown of the affected parts of the web socket controller.
  • The logic for this functionality can be derived from the proof of concept (PoC) implementation in Flow-Go:
    // sendPing sends a periodic ping message to the WebSocket client to keep the connection alive.
    func (w *WebSocketBroker) sendPing() error {
    if err := w.conn.SetWriteDeadline(time.Now().Add(writeWait)); err != nil {
    w.handleWSError(models.NewRestError(http.StatusInternalServerError, "failed to set the initial write deadline for ping", err))
    return err
    }
    if err := w.conn.WriteMessage(websocket.PingMessage, nil); err != nil {
    w.handleWSError(err)
    return err
    }
    return nil
    }
  • Provide tests to validate proper detection and handling of connectivity issues.
@Guitarheroua
Copy link
Contributor Author

Guitarheroua commented Nov 21, 2024

@UlyanaAndrukhiv Also, check a chapter for gorilla control messages documentation, to be sure, that ping-pong handles correctly.

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