prologin.presencesync.client module

Client library for the PresenceSync service. Provides a simple callback based API for sync clients, a login request function and a heartbeat function.

The sync clients use Tornado for async long polling.

class prologin.presencesync.client.AsyncClient(url, pk, pub_secret=None, sub_secret=None)

Bases: prologin.synchronisation.AsyncClient

async get_list()
async remove_expired()
async request_login(login, hostname)
async send_heartbeat(login, hostname)
class prologin.presencesync.client.Client(url, pk, pub_secret=None, sub_secret=None)

Bases: prologin.synchronisation.Client

get_list()

Return a mapping: login -> hostname for all logged in users.

notify_logout(login, hostname)

Tell that login is logging out from hostname to the PresenceSync server. Return None if this is fine, or some failure reason otherwise.

remove_expired()

Remove expired logins.

request_login(login, hostname)

Try to register login as logged on hostname to the PresenceSync server. Return None if login is accepted, or some login failure reason otherwise.

send_heartbeat(login, hostname)

Send a heartbeat to the PresenceSync server in order to keep the login of the user logged on hostname.

prologin.presencesync.client.aio_connect(publish=False)
prologin.presencesync.client.connect(publish=False)