eric6/Documentation/Source/eric6.E5Network.E5JsonServer.html

changeset 8300
72ba9635ec5c
child 8308
f39977d44009
equal deleted inserted replaced
8299:58cf45497dc0 8300:72ba9635ec5c
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.E5Network.E5JsonServer</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.E5JsonServer</h1>
24
25 <p>
26 Module implementing the JSON based server 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="#E5JsonServer">E5JsonServer</a></td>
39 <td>Class implementing a JSON based server 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="E5JsonServer" ID="E5JsonServer"></a>
50 <h2>E5JsonServer</h2>
51
52 <p>
53 Class implementing a JSON based server base class.
54 </p>
55 <h3>Derived from</h3>
56 QTcpServer
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="#E5JsonServer.__init__">E5JsonServer</a></td>
73 <td>Constructor</td>
74 </tr>
75 <tr>
76 <td><a href="#E5JsonServer.__handleDisconnect">__handleDisconnect</a></td>
77 <td>Private slot handling a disconnect of the client.</td>
78 </tr>
79 <tr>
80 <td><a href="#E5JsonServer.__receiveJson">__receiveJson</a></td>
81 <td>Private slot handling received data from the client.</td>
82 </tr>
83 <tr>
84 <td><a href="#E5JsonServer.connectionNames">connectionNames</a></td>
85 <td>Public method to get the list of active connection names.</td>
86 </tr>
87 <tr>
88 <td><a href="#E5JsonServer.handleCall">handleCall</a></td>
89 <td>Public method to handle a method call from the client.</td>
90 </tr>
91 <tr>
92 <td><a href="#E5JsonServer.handleNewConnection">handleNewConnection</a></td>
93 <td>Public slot for new incoming connections from a client.</td>
94 </tr>
95 <tr>
96 <td><a href="#E5JsonServer.sendJson">sendJson</a></td>
97 <td>Public method to send a single command to a client.</td>
98 </tr>
99 <tr>
100 <td><a href="#E5JsonServer.startClient">startClient</a></td>
101 <td>Public method to start a client process.</td>
102 </tr>
103 <tr>
104 <td><a href="#E5JsonServer.stopAllClients">stopAllClients</a></td>
105 <td>Public method to stop all clients.</td>
106 </tr>
107 <tr>
108 <td><a href="#E5JsonServer.stopClient">stopClient</a></td>
109 <td>Public method to stop a client process.</td>
110 </tr>
111 </table>
112 <h3>Static Methods</h3>
113
114 <table>
115 <tr><td>None</td></tr>
116 </table>
117
118 <a NAME="E5JsonServer.__init__" ID="E5JsonServer.__init__"></a>
119 <h4>E5JsonServer (Constructor)</h4>
120 <b>E5JsonServer</b>(<i>name="", multiplex=False, parent=None</i>)
121
122 <p>
123 Constructor
124 </p>
125 <dl>
126
127 <dt><i>name</i> (str)</dt>
128 <dd>
129 name of the server (used for output only)
130 </dd>
131 <dt><i>multiplex</i> (bool)</dt>
132 <dd>
133 flag indicating a multiplexing server
134 </dd>
135 <dt><i>parent</i> (QObject)</dt>
136 <dd>
137 parent object
138 </dd>
139 </dl>
140 <a NAME="E5JsonServer.__handleDisconnect" ID="E5JsonServer.__handleDisconnect"></a>
141 <h4>E5JsonServer.__handleDisconnect</h4>
142 <b>__handleDisconnect</b>(<i>idString</i>)
143
144 <p>
145 Private slot handling a disconnect of the client.
146 </p>
147 <dl>
148
149 <dt><i>idString</i> (str)</dt>
150 <dd>
151 id of the connection been disconnected
152 </dd>
153 </dl>
154 <a NAME="E5JsonServer.__receiveJson" ID="E5JsonServer.__receiveJson"></a>
155 <h4>E5JsonServer.__receiveJson</h4>
156 <b>__receiveJson</b>(<i>idString</i>)
157
158 <p>
159 Private slot handling received data from the client.
160 </p>
161 <dl>
162
163 <dt><i>idString</i> (str)</dt>
164 <dd>
165 id of the connection been disconnected
166 </dd>
167 </dl>
168 <a NAME="E5JsonServer.connectionNames" ID="E5JsonServer.connectionNames"></a>
169 <h4>E5JsonServer.connectionNames</h4>
170 <b>connectionNames</b>(<i></i>)
171
172 <p>
173 Public method to get the list of active connection names.
174 </p>
175 <p>
176 If this is not a multiplexing server, an empty list is returned.
177 </p>
178 <dl>
179 <dt>Return:</dt>
180 <dd>
181 list of active connection names
182 </dd>
183 </dl>
184 <dl>
185 <dt>Return Type:</dt>
186 <dd>
187 list of str
188 </dd>
189 </dl>
190 <a NAME="E5JsonServer.handleCall" ID="E5JsonServer.handleCall"></a>
191 <h4>E5JsonServer.handleCall</h4>
192 <b>handleCall</b>(<i>method, params</i>)
193
194 <p>
195 Public method to handle a method call from the client.
196 </p>
197 <p>
198 Note: This is an empty implementation that must be overridden in
199 derived classes.
200 </p>
201 <dl>
202
203 <dt><i>method</i> (str)</dt>
204 <dd>
205 requested method name
206 </dd>
207 <dt><i>params</i> (dict)</dt>
208 <dd>
209 dictionary with method specific parameters
210 </dd>
211 </dl>
212 <a NAME="E5JsonServer.handleNewConnection" ID="E5JsonServer.handleNewConnection"></a>
213 <h4>E5JsonServer.handleNewConnection</h4>
214 <b>handleNewConnection</b>(<i></i>)
215
216 <p>
217 Public slot for new incoming connections from a client.
218 </p>
219 <a NAME="E5JsonServer.sendJson" ID="E5JsonServer.sendJson"></a>
220 <h4>E5JsonServer.sendJson</h4>
221 <b>sendJson</b>(<i>command, params, flush=False, idString=""</i>)
222
223 <p>
224 Public method to send a single command to a client.
225 </p>
226 <dl>
227
228 <dt><i>command</i> (str)</dt>
229 <dd>
230 command name to be sent
231 </dd>
232 <dt><i>params</i> (dict)</dt>
233 <dd>
234 dictionary of named parameters for the command
235 </dd>
236 <dt><i>flush</i> (bool)</dt>
237 <dd>
238 flag indicating to flush the data to the socket
239 </dd>
240 <dt><i>idString</i> (str)</dt>
241 <dd>
242 id of the connection to send data to
243 </dd>
244 </dl>
245 <a NAME="E5JsonServer.startClient" ID="E5JsonServer.startClient"></a>
246 <h4>E5JsonServer.startClient</h4>
247 <b>startClient</b>(<i>interpreter, clientScript, clientArgs, idString="", environment=None</i>)
248
249 <p>
250 Public method to start a client process.
251 </p>
252 <dl>
253
254 <dt><i>interpreter</i> (str)</dt>
255 <dd>
256 interpreter to be used for the client
257 </dd>
258 <dt><i>clientScript</i> (str)</dt>
259 <dd>
260 path to the client script
261 </dd>
262 <dt><i>clientArgs</i></dt>
263 <dd>
264 list of arguments for the client
265 </dd>
266 <dt><i>idString</i> (str)</dt>
267 <dd>
268 id of the client to be started
269 </dd>
270 <dt><i>environment</i> (dict)</dt>
271 <dd>
272 dictionary of environment settings to pass
273 </dd>
274 </dl>
275 <dl>
276 <dt>Return:</dt>
277 <dd>
278 flag indicating a successful client start
279 </dd>
280 </dl>
281 <dl>
282 <dt>Return Type:</dt>
283 <dd>
284 bool
285 </dd>
286 </dl>
287 <a NAME="E5JsonServer.stopAllClients" ID="E5JsonServer.stopAllClients"></a>
288 <h4>E5JsonServer.stopAllClients</h4>
289 <b>stopAllClients</b>(<i></i>)
290
291 <p>
292 Public method to stop all clients.
293 </p>
294 <a NAME="E5JsonServer.stopClient" ID="E5JsonServer.stopClient"></a>
295 <h4>E5JsonServer.stopClient</h4>
296 <b>stopClient</b>(<i>idString=""</i>)
297
298 <p>
299 Public method to stop a client process.
300 </p>
301 <dl>
302
303 <dt><i>idString</i> (str)</dt>
304 <dd>
305 id of the client to be stopped
306 </dd>
307 </dl>
308 <div align="right"><a href="#top">Up</a></div>
309 <hr />
310 </body></html>

eric ide

mercurial