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