evennia.server.amp_client¶
The Evennia Server service acts as an AMP-client when talking to the Portal. This module sets up the Client-side communication.
- class evennia.server.amp_client.AMPClientFactory(server)[source]¶
Bases:
ReconnectingClientFactoryThis factory creates an instance of an AMP client connection. This handles communication from the be the Evennia ‘Server’ service to the ‘Portal’. The client will try to auto-reconnect on a connection error.
- initialDelay = 1¶
- factor = 1.5¶
- noisy = False¶
- __init__(server)[source]¶
Initializes the client factory.
- Parameters:
server (server) – server instance.
- maxDelay = 1¶
- startedConnecting(connector)[source]¶
Called when starting to try to connect to the Portal AMP server.
- Parameters:
connector (Connector) – Twisted Connector instance representing this connection.
- buildProtocol(addr)[source]¶
Creates an AMPProtocol instance when connecting to the AMP server.
- Parameters:
addr (str) – Connection address. Not used.
- class evennia.server.amp_client.AMPServerClientProtocol(*args, **kwargs)[source]¶
Bases:
AMPMultiConnectionProtocolThis protocol describes the Server service (acting as an AMP-client)’s communication with the Portal (which acts as the AMP-server)
- data_to_portal(command, sessid, **kwargs)[source]¶
Send data across the wire to the Portal
- Parameters:
command (AMP Command) – A protocol send command.
sessid (int) – A unique Session id.
kwargs (any) – Any data to pickle into the command.
- Returns:
deferred (deferred or None) – A deferred with an errback.
Notes
Data will be sent across the wire pickled as a tuple (sessid, kwargs).
- send_MsgServer2Portal(session, **kwargs)[source]¶
- Access method - executed on the Server for sending data
to Portal.
- Parameters:
session (Session) – Unique Session.
kwargs (any, optiona) – Extra data.
- send_AdminServer2Portal(session, operation='', **kwargs)[source]¶
Administrative access method called by the Server to send an instruction to the Portal.
- Parameters:
session (Session) – Session.
operation (char, optional) – Identifier for the server operation, as defined by the global variables in evennia/server/amp.py.
kwargs (dict, optional) – Data going into the adminstrative.
- server_receive_msgportal2server()¶
Helper decorator
- server_receive_adminportal2server()¶
Helper decorator