aiogbserver.utils package

Submodules

aiogbserver.utils.log_config module

aiogbserver.utils.mixins module

class aiogbserver.utils.mixins.ConvertMixin[source]

Bases: object

class aiogbserver.utils.mixins.DbInterfaceMixin(db_path)[source]

Bases: object

add_client(username, info=None)[source]
add_client_history(client_username, ip_addr='8.8.8.8')[source]
add_client_message(client_username, contact_username, text_msg)[source]
add_contact(client_username, contact_username)[source]
del_contact(client_username, contact_username)[source]
get_all_clients()[source]
get_client_by_username(username)[source]
get_client_history(client_username)[source]
get_client_messages(client_username)[source]
get_contacts(client_username)[source]
get_user_status(client_username)[source]
set_user_offline(client_username)[source]
set_user_online(client_username)[source]

aiogbserver.utils.server_messages module

class aiogbserver.utils.server_messages.JimServerMessage[source]

Bases: object

Формирование запроса сервера

probe(sender, status='Are you there?')[source]

Сформировать ​​presence-сообщение присутствие. Сервисное сообщение для извещения сервера о присутствии клиента​ ​ online; :return: Словарь сообщения

response(code=None, error=None)[source]

create response dictionary :param msg: request message in bytes :param code: http code :param error: error text :return: response dictionary

aiogbserver.utils.server_proto module

class aiogbserver.utils.server_proto.ChatServerProtocol(db_path, connections, users)[source]

Bases: asyncio.protocols.Protocol, aiogbserver.utils.mixins.ConvertMixin, aiogbserver.utils.mixins.DbInterfaceMixin

A Server Protocol listening for subscriber messages

action_list(data)[source]
Receive internal request to show/add/del contacts
Parameters:data – msg dict
Returns:
action_msg(data)[source]
Receive message from another user
Parameters:data – msg dict
Returns:
authenticate(username, password)[source]
connection_lost(exc)[source]

Transport Error , which means the client is disconnected.

connection_made(transport)[source]

Called when connection is initiated

data_received(data)[source]

The protocol expects a json message in bytes

eof_received()[source]

EOF(end-of-file)

Module contents