eric7.EricNetwork.EricJsonClient

Module implementing the JSON based client base class.

Global Attributes

None

Classes

EricJsonClient Class implementing a JSON based client base class.

Functions

None


EricJsonClient

Class implementing a JSON based client base class.

Derived from

None

Class Attributes

None

Class Methods

None

Methods

EricJsonClient Constructor
__receiveBytes Private method to receive the given length of bytes.
__receiveJson Private method to receive a JSON encoded 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

None

EricJsonClient (Constructor)

EricJsonClient(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

EricJsonClient.__receiveBytes

__receiveBytes(length)

Private method to receive the given length of bytes.

length (int)
bytes to receive
Return:
received bytes or None if connection closed
Return Type:
bytes

EricJsonClient.__receiveJson

__receiveJson()

Private method to receive a JSON encoded 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)

EricJsonClient.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

EricJsonClient.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

EricJsonClient.run

run()

Public method implementing the main loop of the client.

EricJsonClient.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
Up