Skip to content

Send Last Classified Mission on WebSocket Connection #96

@FelizCoder

Description

@FelizCoder

Description:

Currently, the /classified websocket route handles connection and disconnection events, but does not proactively send any existing classified mission data to the newly connected client. This means a client connecting to /classified may not immediately know of the most recent classified mission, leading to potential synchronization issues and a delayed view of mission status.

Proposed Solution:

Upon a new WebSocket connection to /classified, the classified_missions_ws endpoint should retrieve and send the last known classified mission (if any) to the client immediately after the connection is established. This ensures the client has the most up-to-date information from the moment it connects.

Implementation Details:

  1. Modify the classified_missions_ws endpoint to call a new service method (e.g., get_latest_classified_mission()) to retrieve the latest classified mission data.
  2. After establishing the WebSocket connection, send the retrieved mission data to the client.
  3. Ensure this retrieval and send operation does not block or significantly delay the connection establishment. It's important that the websocket connection is fully established.

Affected Files:

  • app/api/v1/endpoints/missions.py
  • Potentially app/services/missions/flow.py if the recent mission retrieval logic resides there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions