|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric6.E5Network.E5JsonClient</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>eric6.E5Network.E5JsonClient</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="#E5JsonClient">E5JsonClient</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="E5JsonClient" ID="E5JsonClient"></a> |
|
50 <h2>E5JsonClient</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="#E5JsonClient.__init__">E5JsonClient</a></td> |
|
73 <td>Constructor</td> |
|
74 </tr> |
|
75 <tr> |
|
76 <td><a href="#E5JsonClient.__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="#E5JsonClient.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="#E5JsonClient.run">run</a></td> |
|
85 <td>Public method implementing the main loop of the client.</td> |
|
86 </tr> |
|
87 <tr> |
|
88 <td><a href="#E5JsonClient.sendJson">sendJson</a></td> |
|
89 <td>Public method to send a single refactoring command to the server.</td> |
|
90 </tr> |
|
91 </table> |
|
92 <h3>Static Methods</h3> |
|
93 |
|
94 <table> |
|
95 <tr><td>None</td></tr> |
|
96 </table> |
|
97 |
|
98 <a NAME="E5JsonClient.__init__" ID="E5JsonClient.__init__"></a> |
|
99 <h4>E5JsonClient (Constructor)</h4> |
|
100 <b>E5JsonClient</b>(<i>host, port, idString=""</i>) |
|
101 |
|
102 <p> |
|
103 Constructor |
|
104 </p> |
|
105 <dl> |
|
106 |
|
107 <dt><i>host</i> (str)</dt> |
|
108 <dd> |
|
109 ip address the background service is listening |
|
110 </dd> |
|
111 <dt><i>port</i> (int)</dt> |
|
112 <dd> |
|
113 port of the background service |
|
114 </dd> |
|
115 <dt><i>idString</i> (str)</dt> |
|
116 <dd> |
|
117 assigned client id to be sent back to the server in |
|
118 order to identify the connection |
|
119 </dd> |
|
120 </dl> |
|
121 <a NAME="E5JsonClient.__receiveJson" ID="E5JsonClient.__receiveJson"></a> |
|
122 <h4>E5JsonClient.__receiveJson</h4> |
|
123 <b>__receiveJson</b>(<i></i>) |
|
124 |
|
125 <p> |
|
126 Private method to receive a JSON encode command and data from the |
|
127 server. |
|
128 </p> |
|
129 <dl> |
|
130 <dt>Return:</dt> |
|
131 <dd> |
|
132 tuple containing the received command and a dictionary |
|
133 containing the associated data |
|
134 </dd> |
|
135 </dl> |
|
136 <dl> |
|
137 <dt>Return Type:</dt> |
|
138 <dd> |
|
139 tuple of (str, dict) |
|
140 </dd> |
|
141 </dl> |
|
142 <a NAME="E5JsonClient.handleCall" ID="E5JsonClient.handleCall"></a> |
|
143 <h4>E5JsonClient.handleCall</h4> |
|
144 <b>handleCall</b>(<i>method, params</i>) |
|
145 |
|
146 <p> |
|
147 Public method to handle a method call from the server. |
|
148 </p> |
|
149 <p> |
|
150 Note: This is an empty implementation that must be overridden in |
|
151 derived classes. |
|
152 </p> |
|
153 <dl> |
|
154 |
|
155 <dt><i>method</i> (str)</dt> |
|
156 <dd> |
|
157 requested method name |
|
158 </dd> |
|
159 <dt><i>params</i> (dict)</dt> |
|
160 <dd> |
|
161 dictionary with method specific parameters |
|
162 </dd> |
|
163 </dl> |
|
164 <a NAME="E5JsonClient.run" ID="E5JsonClient.run"></a> |
|
165 <h4>E5JsonClient.run</h4> |
|
166 <b>run</b>(<i></i>) |
|
167 |
|
168 <p> |
|
169 Public method implementing the main loop of the client. |
|
170 </p> |
|
171 <a NAME="E5JsonClient.sendJson" ID="E5JsonClient.sendJson"></a> |
|
172 <h4>E5JsonClient.sendJson</h4> |
|
173 <b>sendJson</b>(<i>command, params</i>) |
|
174 |
|
175 <p> |
|
176 Public method to send a single refactoring command to the server. |
|
177 </p> |
|
178 <dl> |
|
179 |
|
180 <dt><i>command</i> (str)</dt> |
|
181 <dd> |
|
182 command name to be sent |
|
183 </dd> |
|
184 <dt><i>params</i> (dict)</dt> |
|
185 <dd> |
|
186 dictionary of named parameters for the command |
|
187 </dd> |
|
188 </dl> |
|
189 <div align="right"><a href="#top">Up</a></div> |
|
190 <hr /> |
|
191 </body></html> |