-
Notifications
You must be signed in to change notification settings - Fork 1
Notifications
The server is capable of sending notifications. These notifications can be various, but mostly they contain information about certain events happening and registered on the server side such as player has completed a daily task or a new voting has been started.
For the notifications mechanism to work a MQTT protocol is used. The MQTT protocol has 2 key components: publisher (=server) and subscriber (=client). The publisher can publish a message (= send notification) and the subscribers can listen and wait for the message to come.
The subscribers can listen to messages by using topics (= endpoints). When some message come to a specific topic, subscriber gets it. Topic is a unique string usually containing slashes (/) - separators. The separators are used for organizing the structure of the topics overall.
Subscriber can listen to a specific topic and also it can use a wildcard, for example to subscribe to all of the topics starting with a specific string, i.e. with "/clan" to listen to all notifications related to clans.
The messages coming from a topics can have any format, there are not restrictions for that.
More detailed description about MQTT can be found here
The notifications mechanism with topics structure and more built on the server can be found here
Below are tables with all the topics and their payloads implemented.
| Topic | When | What | Payload example |
|---|---|---|---|
| /player/67ded676fee629524e992e13/daily_task/win_battle/new | Task received / booked for player | Received / booked task | {"_id":"67ded676fee629524e992e14","clan_id":"67ded676fee629524e992e15","player_id":"67ded676fee629524e992e16","type":"win_battle","title":{"fi":"Voita 10 pelia"},"amount":10,"amountLeft":10,"points":20,"coins":30,"startedAt":"2025-03-22T15:25:42.847Z","timeLimitMinutes":120} |
| /player/67ded888c689a5b610507b76/daily_task/win_battle/update | Player completes one of the task sub tasks, i.e. player won 1 game out of 10 | Updated task data | {"_id":"67ded888c689a5b610507b77","clan_id":"67ded888c689a5b610507b78","player_id":"67ded888c689a5b610507b79","type":"win_battle","title":{"fi":"Voita 10 pelia"},"amount":10,"amountLeft":9,"points":20,"coins":30,"startedAt":"2025-03-22T15:34:32.288Z","timeLimitMinutes":120} |
| /player/67ded96a2269db4ae9c1af10/daily_task/win_battle/end | Player completes all sub tasks | Completed task data | {"_id":"67ded96a2269db4ae9c1af11","clan_id":"67ded96a2269db4ae9c1af12","player_id":"67ded96a2269db4ae9c1af13","type":"win_battle","title":{"fi":"Voita 10 pelia"},"amount":10,"amountLeft":0,"points":20,"coins":30,"startedAt":"2025-03-22T15:38:18.856Z","timeLimitMinutes":120} |
| Topic | When | What | Payload example |
|---|---|---|---|
| /clan/67dee2c5ad0f5028e61d6380/voting/buying_item/new | One of the clan members book an item from a flea market and want to buy it | Data about the item, the player that booked the item, and the voting data | {"topic":"/clan/67dee2c5ad0f5028e61d6380/voting/67dee2c5ad0f5028e61d637e","status":"new","voting_id":"67dee2c5ad0f5028e61d637e","type":"buying_item","item":{"_id":"67dee2c5ad0f5028e61d6384","name":"ArmChair_Rakkaus","weight":10,"recycling":"Glass","qualityLevel":"common","unityKey":"key","status":"available","isFurniture":true,"price":120,"clan_id":"67dee2c5ad0f5028e61d6385"},"organizer":{"_id":"67dee2c5ad0f5028e61d6386","name":"player","points":20,"backpackCapacity":12,"uniqueIdentifier":"identifier","parentalAuth":null,"gameStatistics":null,"profile_id":"67dee2c5ad0f5028e61d6387","clan_id":"67dee2c5ad0f5028e61d6388","Clan":null,"CustomCharacter":[]}} |
| /clan/67dee4a9b8100b2ab4111406/voting/buying_item/update | Some of the players have voted | Data about the item, the player that booked the item, and the voting data | {"topic":"/clan/67dee4a9b8100b2ab4111406/voting/67dee4a9b8100b2ab4111404","status":"update","voting_id":"67dee4a9b8100b2ab4111404","type":"buying_item","item":{"_id":"67dee4a9b8100b2ab411140a","name":"ArmChair_Rakkaus","weight":10,"recycling":"Glass","qualityLevel":"common","unityKey":"key","status":"available","isFurniture":true,"price":120,"clan_id":"67dee4a9b8100b2ab411140b"},"voter":{"_id":"67dee4a9b8100b2ab411140c","name":"player","points":20,"backpackCapacity":12,"uniqueIdentifier":"identifier","parentalAuth":null,"gameStatistics":null,"profile_id":"67dee4a9b8100b2ab411140d","clan_id":"67dee4a9b8100b2ab411140e","Clan":null,"CustomCharacter":[]}} |
| /clan/67dee567c34dc94aa4f09273/voting/buying_item/end | Voting has ended | Min amount of clan members has voted | {"topic":"/clan/67dee567c34dc94aa4f09273/voting/67dee567c34dc94aa4f09271","status":"end","voting_id":"67dee567c34dc94aa4f09271","type":"buying_item","item":{"_id":"67dee567c34dc94aa4f09277","name":"ArmChair_Rakkaus","weight":10,"recycling":"Glass","qualityLevel":"common","unityKey":"key","status":"available","isFurniture":true,"price":120,"clan_id":"67dee567c34dc94aa4f09278"}} |
| Topic | When | What | Payload example |
|---|---|---|---|
| /clan/67dee2c5ad0f5028e61d6380/voting/selling_item/new | One of the clan members want to sell an item | Data about the item, the player that willing to sell the item, and the voting data | {"topic":"/clan/67dee2c5ad0f5028e61d6380/voting/67dee2c5ad0f5028e61d637e","status":"new","voting_id":"67dee2c5ad0f5028e61d637e","type":"selling_item","item":{"_id":"67dee2c5ad0f5028e61d6384","name":"ArmChair_Rakkaus","weight":10,"recycling":"Glass","qualityLevel":"common","unityKey":"key","status":"available","isFurniture":true,"price":120,"clan_id":"67dee2c5ad0f5028e61d6385"},"organizer":{"_id":"67dee2c5ad0f5028e61d6386","name":"player","points":20,"backpackCapacity":12,"uniqueIdentifier":"identifier","parentalAuth":null,"gameStatistics":null,"profile_id":"67dee2c5ad0f5028e61d6387","clan_id":"67dee2c5ad0f5028e61d6388","Clan":null,"CustomCharacter":[]}} |
| /clan/67dee4a9b8100b2ab4111406/voting/selling_item/update | Some of the players have voted | Data about the item, the player that willing to sell the item, and the voting data | {"topic":"/clan/67dee4a9b8100b2ab4111406/voting/67dee4a9b8100b2ab4111404","status":"update","voting_id":"67dee4a9b8100b2ab4111404","type":"selling_item","item":{"_id":"67dee4a9b8100b2ab411140a","name":"ArmChair_Rakkaus","weight":10,"recycling":"Glass","qualityLevel":"common","unityKey":"key","status":"available","isFurniture":true,"price":120,"clan_id":"67dee4a9b8100b2ab411140b"},"voter":{"_id":"67dee4a9b8100b2ab411140c","name":"player","points":20,"backpackCapacity":12,"uniqueIdentifier":"identifier","parentalAuth":null,"gameStatistics":null,"profile_id":"67dee4a9b8100b2ab411140d","clan_id":"67dee4a9b8100b2ab411140e","Clan":null,"CustomCharacter":[]}} |
| /clan/67dee567c34dc94aa4f09273/voting/selling_item/end | Voting has ended | Min amount of clan members has voted | {"topic":"/clan/67dee567c34dc94aa4f09273/voting/67dee567c34dc94aa4f09271","status":"end","voting_id":"67dee567c34dc94aa4f09271","type":"selling_item","item":{"_id":"67dee567c34dc94aa4f09277","name":"ArmChair_Rakkaus","weight":10,"recycling":"Glass","qualityLevel":"common","unityKey":"key","status":"available","isFurniture":true,"price":120,"clan_id":"67dee567c34dc94aa4f09278"}} |
| Topic | When | What | Payload example |
|---|---|---|---|
| /clan/67ded676fee629524e992e13/jukebox/song/update | New song starts to play | New song | {"topic":"/clan/68e7777139519eaf400a0e3d/jukebox/song/update","song":{"songId":"67dee567c34dc94aa4f09277","startedAt":1761207021502}} |