Use pip install -r requirements.txt
to install all the requirements first.
To start the server, use python server.py
The server is built with Flask and tornado.
The server uses APN for iOS push notifications, PyAPNs2 to interact with APNs, and FCM for Android push notifications.
Right now the server only receives onion requests through the endpoint /loki/v2/lsrpc
for
register
: register a device token associated with a session idunregister
: unregister a device token from a session id's devicessubscribe_closed_group
: add a session id to a closed group as a memberunsubscribe_closed_group
remove a session id from a closed group membersnotify
: send a message from remote notification
The new push notification server works this way:
- The client (Session Desktop or Mobile app) sends encrypted message data with the recipients' session id to server.
- The server checks the database to see if the recipients has registered their devices.
- The server generates and sends the push notification to the devices registered with their tokens.
The server will store some statistics data every 12 hours for analysing the traffic going through. The data includes:
- The number of messages sent to the server
- The number of messages sent to closed groups
- The number of push notifications sent to iOS devices
- The number of push notifications sent to Android devices
There is also an endpoint /get_statistics_data
to get the data above.