eric6.E5Network.E5JsonClient
Module implementing the JSON based client base class.
Global Attributes
Classes
E5JsonClient |
Class implementing a JSON based client base class. |
Functions
E5JsonClient
Class implementing a JSON based client base class.
Derived from
None
Class Attributes
Class Methods
Methods
E5JsonClient |
Constructor |
__receiveJson |
Private method to receive a JSON encode command and data from the server. |
handleCall |
Public method to handle a method call from the server. |
poll |
Public method to check and receive one message (if available). |
run |
Public method implementing the main loop of the client. |
sendJson |
Public method to send a single refactoring command to the server. |
Static Methods
E5JsonClient (Constructor)
E5JsonClient(host, port, idString="")
Constructor
- host (str)
-
ip address the background service is listening
- port (int)
-
port of the background service
- idString (str)
-
assigned client id to be sent back to the server in
order to identify the connection
E5JsonClient.__receiveJson
__receiveJson()
Private method to receive a JSON encode command and data from the
server.
- Return:
-
tuple containing the received command and a dictionary
containing the associated data
- Return Type:
-
tuple of (str, dict)
E5JsonClient.handleCall
handleCall(method, params)
Public method to handle a method call from the server.
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
E5JsonClient.poll
poll(waitMethod="")
Public method to check and receive one message (if available).
- waitMethod (str)
-
name of a method to wait for
- Return:
-
dictionary containing the data of the waited for method
- Return Type:
-
dict
E5JsonClient.run
run()
Public method implementing the main loop of the client.
E5JsonClient.sendJson
sendJson(command, params)
Public method to send a single refactoring command to the server.
- command (str)
-
command name to be sent
- params (dict)
-
dictionary of named parameters for the command