---
# System prepended metadata

title: Notification badge
tags: [Lale, Synapse, Matrix]

---

# Notification badge 
###### tags: `Lale` `Matrix` `Synapse`
## Problem: 
- We want to get the correct notification badge. 

## Facts: 
- `Matrix` sends notification information (including the `badge` ("unread")) to the `Push Server` (Sygnal). 
- `Sygnal` send notifications to `iOS` (APNS) and `Androi`d device (GCM). 
- `Matrix` knows the number of unread messages from the Matrix-DB (`event_push_summary.notif_count`) 
- `event_push_summary` table contains the summary of the unread message for each user & room! 
- Matrix builds the `event_push_summary` table by calculating the number of unread messages for each room. 
- The last read message for each room & user in the table `receipts_linearized`


## Possible Solutions:
1. **Push server sends the number of badges** by hijacked the data sent by Matrix. The push server is also **able to connect to the DB**. 
But, the number of badges/unread that the push server received is not always correct. The data from the DB is also not always correct. 

2. Client-apps tell the matrix server, **the correct** badge/unread message, so the matrix server could send **the correct** number of badges to the push server. 

	### Problem: 
	- We **don't know** how to tell the matrix server the number of badges. 
	- The matrix server sends the number of badges based on **the database**. 