|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.EricNetwork.EricJsonClient</title> |
|
4 <meta charset="UTF-8"> |
|
5 <link rel="stylesheet" href="styles.css"> |
|
6 </head> |
|
7 <body> |
|
8 <a NAME="top" ID="top"></a> |
|
9 <h1>eric7.EricNetwork.EricJsonClient</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing the JSON based client base class. |
|
13 </p> |
|
14 <h3>Global Attributes</h3> |
|
15 |
|
16 <table> |
|
17 <tr><td>None</td></tr> |
|
18 </table> |
|
19 <h3>Classes</h3> |
|
20 |
|
21 <table> |
|
22 |
|
23 <tr> |
|
24 <td><a href="#EricJsonClient">EricJsonClient</a></td> |
|
25 <td>Class implementing a JSON based client base class.</td> |
|
26 </tr> |
|
27 </table> |
|
28 <h3>Functions</h3> |
|
29 |
|
30 <table> |
|
31 <tr><td>None</td></tr> |
|
32 </table> |
|
33 <hr /> |
|
34 <hr /> |
|
35 <a NAME="EricJsonClient" ID="EricJsonClient"></a> |
|
36 <h2>EricJsonClient</h2> |
|
37 |
|
38 <p> |
|
39 Class implementing a JSON based client base class. |
|
40 </p> |
|
41 <h3>Derived from</h3> |
|
42 None |
|
43 <h3>Class Attributes</h3> |
|
44 |
|
45 <table> |
|
46 <tr><td>None</td></tr> |
|
47 </table> |
|
48 <h3>Class Methods</h3> |
|
49 |
|
50 <table> |
|
51 <tr><td>None</td></tr> |
|
52 </table> |
|
53 <h3>Methods</h3> |
|
54 |
|
55 <table> |
|
56 |
|
57 <tr> |
|
58 <td><a href="#EricJsonClient.__init__">EricJsonClient</a></td> |
|
59 <td>Constructor</td> |
|
60 </tr> |
|
61 <tr> |
|
62 <td><a href="#EricJsonClient.__receiveJson">__receiveJson</a></td> |
|
63 <td>Private method to receive a JSON encode command and data from the server.</td> |
|
64 </tr> |
|
65 <tr> |
|
66 <td><a href="#EricJsonClient.handleCall">handleCall</a></td> |
|
67 <td>Public method to handle a method call from the server.</td> |
|
68 </tr> |
|
69 <tr> |
|
70 <td><a href="#EricJsonClient.poll">poll</a></td> |
|
71 <td>Public method to check and receive one message (if available).</td> |
|
72 </tr> |
|
73 <tr> |
|
74 <td><a href="#EricJsonClient.run">run</a></td> |
|
75 <td>Public method implementing the main loop of the client.</td> |
|
76 </tr> |
|
77 <tr> |
|
78 <td><a href="#EricJsonClient.sendJson">sendJson</a></td> |
|
79 <td>Public method to send a single refactoring command to the server.</td> |
|
80 </tr> |
|
81 </table> |
|
82 <h3>Static Methods</h3> |
|
83 |
|
84 <table> |
|
85 <tr><td>None</td></tr> |
|
86 </table> |
|
87 |
|
88 <a NAME="EricJsonClient.__init__" ID="EricJsonClient.__init__"></a> |
|
89 <h4>EricJsonClient (Constructor)</h4> |
|
90 <b>EricJsonClient</b>(<i>host, port, idString=""</i>) |
|
91 |
|
92 <p> |
|
93 Constructor |
|
94 </p> |
|
95 <dl> |
|
96 |
|
97 <dt><i>host</i> (str)</dt> |
|
98 <dd> |
|
99 IP address the background service is listening |
|
100 </dd> |
|
101 <dt><i>port</i> (int)</dt> |
|
102 <dd> |
|
103 port of the background service |
|
104 </dd> |
|
105 <dt><i>idString</i> (str)</dt> |
|
106 <dd> |
|
107 assigned client id to be sent back to the server in |
|
108 order to identify the connection |
|
109 </dd> |
|
110 </dl> |
|
111 <a NAME="EricJsonClient.__receiveJson" ID="EricJsonClient.__receiveJson"></a> |
|
112 <h4>EricJsonClient.__receiveJson</h4> |
|
113 <b>__receiveJson</b>(<i></i>) |
|
114 |
|
115 <p> |
|
116 Private method to receive a JSON encode command and data from the |
|
117 server. |
|
118 </p> |
|
119 <dl> |
|
120 <dt>Return:</dt> |
|
121 <dd> |
|
122 tuple containing the received command and a dictionary |
|
123 containing the associated data |
|
124 </dd> |
|
125 </dl> |
|
126 <dl> |
|
127 <dt>Return Type:</dt> |
|
128 <dd> |
|
129 tuple of (str, dict) |
|
130 </dd> |
|
131 </dl> |
|
132 <a NAME="EricJsonClient.handleCall" ID="EricJsonClient.handleCall"></a> |
|
133 <h4>EricJsonClient.handleCall</h4> |
|
134 <b>handleCall</b>(<i>method, params</i>) |
|
135 |
|
136 <p> |
|
137 Public method to handle a method call from the server. |
|
138 </p> |
|
139 <p> |
|
140 Note: This is an empty implementation that must be overridden in |
|
141 derived classes. |
|
142 </p> |
|
143 <dl> |
|
144 |
|
145 <dt><i>method</i> (str)</dt> |
|
146 <dd> |
|
147 requested method name |
|
148 </dd> |
|
149 <dt><i>params</i> (dict)</dt> |
|
150 <dd> |
|
151 dictionary with method specific parameters |
|
152 </dd> |
|
153 </dl> |
|
154 <a NAME="EricJsonClient.poll" ID="EricJsonClient.poll"></a> |
|
155 <h4>EricJsonClient.poll</h4> |
|
156 <b>poll</b>(<i>waitMethod=""</i>) |
|
157 |
|
158 <p> |
|
159 Public method to check and receive one message (if available). |
|
160 </p> |
|
161 <dl> |
|
162 |
|
163 <dt><i>waitMethod</i> (str)</dt> |
|
164 <dd> |
|
165 name of a method to wait for |
|
166 </dd> |
|
167 </dl> |
|
168 <dl> |
|
169 <dt>Return:</dt> |
|
170 <dd> |
|
171 dictionary containing the data of the waited for method |
|
172 </dd> |
|
173 </dl> |
|
174 <dl> |
|
175 <dt>Return Type:</dt> |
|
176 <dd> |
|
177 dict |
|
178 </dd> |
|
179 </dl> |
|
180 <a NAME="EricJsonClient.run" ID="EricJsonClient.run"></a> |
|
181 <h4>EricJsonClient.run</h4> |
|
182 <b>run</b>(<i></i>) |
|
183 |
|
184 <p> |
|
185 Public method implementing the main loop of the client. |
|
186 </p> |
|
187 <a NAME="EricJsonClient.sendJson" ID="EricJsonClient.sendJson"></a> |
|
188 <h4>EricJsonClient.sendJson</h4> |
|
189 <b>sendJson</b>(<i>command, params</i>) |
|
190 |
|
191 <p> |
|
192 Public method to send a single refactoring command to the server. |
|
193 </p> |
|
194 <dl> |
|
195 |
|
196 <dt><i>command</i> (str)</dt> |
|
197 <dd> |
|
198 command name to be sent |
|
199 </dd> |
|
200 <dt><i>params</i> (dict)</dt> |
|
201 <dd> |
|
202 dictionary of named parameters for the command |
|
203 </dd> |
|
204 </dl> |
|
205 <div align="right"><a href="#top">Up</a></div> |
|
206 <hr /> |
|
207 </body></html> |