Skip to content

842 feature request update and expand the mqtt messaging system to be properly connected to the events happening in server and send messages to the clients parts 1 3#860

Open
tickBit wants to merge 59 commits into
devfrom
842-feature-request-update-and-expand-the-mqtt-messaging-system-to-be-properly-connected-to-the-events-happening-in-server-and-send-messages-to-the-clients-parts-1-3
Open

842 feature request update and expand the mqtt messaging system to be properly connected to the events happening in server and send messages to the clients parts 1 3#860
tickBit wants to merge 59 commits into
devfrom
842-feature-request-update-and-expand-the-mqtt-messaging-system-to-be-properly-connected-to-the-events-happening-in-server-and-send-messages-to-the-clients-parts-1-3

Conversation

@tickBit

@tickBit tickBit commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Brief description

Issue 842's features 1-3 implemented. Merge conflicts solved locally.
There seemed to be merge conflicts only in 1 file and that was a test file: addVote.ts.

I decided to try to merge this into dev before there is more changes.

Change list

  • MQTT messaging system to renewed to Jukebox, implemented to voting, daily tasks and to clan change status

Documentation:

Short documentation to jukebox (more detailed in the repo):

The published topics are:

  • Song Update Topic:
    /clan/{clanId}/jukebox/song/update
    
  • Playlist Update Topic:
    /clan/{clanId}/jukebox/playlist/update
    

Where:

  • {clanId} is the unique ID of the player's clan.

And short documentation to voting (more detailed in the repo):

Frontend clients that need all voting updates for one clan should subscribe to:

/clan/{clanId}/voting/+/+

The published topic is:

/clan/{clanId}/voting/{votingType}/{status}

Where:

  • {clanId} is voting.organizer.clan_id
  • {votingType} is one value from VotingType
  • {status} is one of new, update, end

Current voting types:

  • flea_market_sell_item
  • flea_market_buy_item
  • change_item_price
  • shop_buy_item
  • set_clan_role
  • clan_governance_update

All voting notifications use this payload shape:

{
  topic: `/clan/${clanId}/voting/${votingId}`,
  status: 'new' | 'update' | 'end',
  voting_id: string,
  type: VotingType,
  entity: unknown,
  organizer?: PlayerDto,
  voter?: PlayerDto,
  votes?: Vote[],
  endedAt?: Date
}

payload.topic is a voting-instance identifier for the frontend. It is not the
MQTT broker topic. The MQTT broker topic remains
/clan/{clanId}/voting/{votingType}/{status}.

Short documentation to daily tasks:

Method               | MQTT topic path                                   | Description                                    | Payload
-------------------------------------------------------------------------------------------------------------------------------------------
taskReceived         | /player/{player_id}/daily_task/{task_type}/new    | Player got new daily task.                     | TTask
taskUpdated          | /player/{player_id}/daily_task/{task_type}/update | Daily task was advanced (some part of a task). | TTask
taskError            | /player/{player_id}/daily_task/{task_type}/error  | Error in task.                                 | APIError
taskCompleted        | /player/{player_id}/daily_task/{task_type}/end    | Player completed a task.                       | TTask
taskCompletedForClan | /clan/{clan_id}/daily_task/{task_type}/end        | Member of a clan completed a clan's task       | { task: TTask, completedByPlayerId: string }`
milestoneReached     | /clan/{clan_id}/daily_task/milestone/update       | A clan achieved new milestone                  | { task: TTask, completedByPlayerId: string, reachedMilestones: number[] }

I think, it's good to get this to be tested in practice, before making even more changes.

@CapoMK25 CapoMK25 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I've walked through most of this PR and it looks good. I won't approve it yet as I haven't seen the full picture yet.

@tickBit

tickBit commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator Author

In many places in the code file.notifier.ts is updated to use MQTT notification system. For instance, there are updated voting.notifier.ts and clan.notifier.ts. In join.service.ts related to the clan the related notifier is used.

There are 59 commits in total. I should have made PR after issue 842's part 1, the jukebox & voting part to avoid to one PR to have too much changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants