~> whoami
- Patrick Louis
- Student @ USEK
- *nixer
- Programmer
Implement a push notification system for MHM
Instead of asking the server when the data is updated let the server notify you.
Push Technology
- Long Polling
- Pushlet (Comet)
- Flash XML Sockets
- WebSockets
- Full-Duplex
- HTML5
- Efficient
- Low-Level
- Persistent
Why?
AJAX (Polling)
DB
Backend
Client
WebSockets (Push)
DB
Daemon
WS-srv
Client
1 request ID and action on msisdn
2 generate ID and add a row to the DB
3 reply with ID and STATUS
4 poll the backend every 1s until a change of STATUS
1 open WS and send action on msisdn
2 add client to the list of waiting clients and notify daemon
3 daemon is aware of the STATUS in the DB
4 notify that the STATUS of a client has changed
5 receives the new STATUS and response through WS
Overhead (every requests): 400~600B
NB Msgs Sent: 300(2 per seconds)
Average Msg Size: 800B
Total Sent: 240KB
Support: 100%
Overhead: 200B(only once) + 2B(after)
NB Msgs Sent: 1(from client)+3~5(from server)
Average Msg Size: 288B
Total Sent: 1.4KB ~ 2KB
Support: 74%