Sakib Sami' Blog


Newbie programmer, Java fan, Rosogolla lover, Mom's little kid.


Building custom push notification service with MQTT

MQTT (Message Queue Telemetry Transport) is a lightweight messaging protocol specially designed for IOT by IBM. MQTT works on Publish-Subscribe Model.
Facebook & WhatsApp uses MQTT for their messaging engine.

Well, In the tutorial I am going to show how you can implement a push notification service using MQTT. I am not going to implement complete service but a prototype on how it can be.

Tools will used,
1. EMQ (MQTT Broker)
2. MongoDB (To store user's information)
3. Admin Dashboard (To publish notification)
4. Android App (Client)
5. Eclipse Paho MQTT client (Android, JavaScript)

Its the big picture, how components in the system are interacting with each other.

The idea is user will connect to mqtt broker, broker will authenticate them with data in mongodb. Assume a user as system admin who will publish notifications & other users will be subscribed to receive these notifications. Suppose, a@email.com is a user, after authentication with the email address the user will be subscribed to the topic(a@email.com) and then from admin dashboard if you publish a message on topic a@email.com the user will receive it. Thats all.

MongoDB Document Schema,

{
    "user_email": "email address of user",
    "user_password": "password of user",
    "type": "admin/user"
}

Assume this is the admin dashboard,

There are 3 buttons. One to Logout, One is to Add User and another to Send Push notifications.
In screen the push notification view is visible. Admin dashboard is connected to MQTT broker via Websocket. User Email Address is the topic where message is going to be published. When clicked on Send it will publish the message using Websocket.

Now if the respective email address is connected & subscribed to respective topic then the client will receive the message.

Note : This is just a prototype for educational purpose not production ready. To use it in production system you have to implement security & other tuning where needed.

Manage cloud storage with Minio server

Minio is a AWS S3 compatible opensource cloud storage server licensed under apache2 and developed o…

minio-server, minio, cloud, cloud-storage

Why I perfer Kotlin over Java for Android

First you should know what is kotlin. Ok, Kotlin is a JVM based statically typed programming languag…

java, programming, kotlin, android, jvm