eric7.EricNetwork.EricJsonServer
Module implementing the JSON based server base class.
Global Attributes
Classes
Functions
EricJsonServer
Class implementing a JSON based server base class.
Derived from
QTcpServer
Class Attributes
Class Methods
Methods
Static Methods
EricJsonServer (Constructor)
EricJsonServer(name="", interface="127.0.0.1", multiplex=False, parent=None, releaseMode=False, )
Constructor
- name (str (optional))
-
name of the server (used for output only) (defaults to "")
- interface (str (optional))
-
network interface to be used (IP address or one of "all",
"allv4", "allv6", "localv4" or "localv6") (defaults to "127.0.0.1")
- multiplex (bool (optional))
-
flag indicating a multiplexing server (defaults to False)
- parent (QObject (optional))
-
reference to the parent object (defaults to None)
- releaseMode (bool (optional))
-
flag indicating the mode of operations (defaults to False)
EricJsonServer.__handleDisconnect
__handleDisconnect(idString)
Private slot handling a disconnect of the client.
- idString (str)
-
id of the connection been disconnected
EricJsonServer.__receiveJson
__receiveJson(idString)
Private slot handling received data from the client.
- idString (str)
-
id of the connection
EricJsonServer.connectionNames
connectionNames()
Public method to get the list of active connection names.
If this is not a multiplexing server, an empty list is returned.
- Return:
-
list of active connection names
- Return Type:
-
list of str
EricJsonServer.handleCall
handleCall(method, params)
Public method to handle a method call from the client.
Note: This is an empty implementation that must be overridden in
derived classes.
- method (str)
-
requested method name
- params (dict)
-
dictionary with method specific parameters
EricJsonServer.handleNewConnection
handleNewConnection()
Public slot for new incoming connections from a client.
EricJsonServer.sendJson
sendJson(command, params, flush=False, idString="")
Public method to send a single command to a client.
- command (str)
-
command name to be sent
- params (dict)
-
dictionary of named parameters for the command
- flush (bool)
-
flag indicating to flush the data to the socket
- idString (str)
-
id of the connection to send data to
EricJsonServer.startClient
startClient(interpreter, clientScript, clientArgs, idString="", environment=None)
Public method to start a client process.
- interpreter (str)
-
interpreter to be used for the client
- clientScript (str)
-
path to the client script
- clientArgs (list of str)
-
list of arguments for the client
- idString (str)
-
id of the client to be started
- environment (dict)
-
dictionary of environment settings to pass
- Return:
-
flag indicating a successful client start and the exit code
in case of an issue
- Return Type:
-
bool, int
EricJsonServer.stopAllClients
stopAllClients()
Public method to stop all clients.
EricJsonServer.stopClient
stopClient(idString="")
Public method to stop a client process.
- idString (str)
-
id of the client to be stopped