eric7/Documentation/Source/eric7.EricNetwork.EricJsonServer.html

branch
eric7
changeset 8372
e0227a7c850e
child 8596
d64760b2da50
equal deleted inserted replaced
8371:d6062691d424 8372:e0227a7c850e
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.EricNetwork.EricJsonServer</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.EricJsonServer</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="#EricJsonServer">EricJsonServer</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="EricJsonServer" ID="EricJsonServer"></a>
50 <h2>EricJsonServer</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="#EricJsonServer.__init__">EricJsonServer</a></td>
73 <td>Constructor</td>
74 </tr>
75 <tr>
76 <td><a href="#EricJsonServer.__handleDisconnect">__handleDisconnect</a></td>
77 <td>Private slot handling a disconnect of the client.</td>
78 </tr>
79 <tr>
80 <td><a href="#EricJsonServer.__receiveJson">__receiveJson</a></td>
81 <td>Private slot handling received data from the client.</td>
82 </tr>
83 <tr>
84 <td><a href="#EricJsonServer.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="#EricJsonServer.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="#EricJsonServer.handleNewConnection">handleNewConnection</a></td>
93 <td>Public slot for new incoming connections from a client.</td>
94 </tr>
95 <tr>
96 <td><a href="#EricJsonServer.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="#EricJsonServer.startClient">startClient</a></td>
101 <td>Public method to start a client process.</td>
102 </tr>
103 <tr>
104 <td><a href="#EricJsonServer.stopAllClients">stopAllClients</a></td>
105 <td>Public method to stop all clients.</td>
106 </tr>
107 <tr>
108 <td><a href="#EricJsonServer.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="EricJsonServer.__init__" ID="EricJsonServer.__init__"></a>
119 <h4>EricJsonServer (Constructor)</h4>
120 <b>EricJsonServer</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="EricJsonServer.__handleDisconnect" ID="EricJsonServer.__handleDisconnect"></a>
141 <h4>EricJsonServer.__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="EricJsonServer.__receiveJson" ID="EricJsonServer.__receiveJson"></a>
155 <h4>EricJsonServer.__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="EricJsonServer.connectionNames" ID="EricJsonServer.connectionNames"></a>
169 <h4>EricJsonServer.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="EricJsonServer.handleCall" ID="EricJsonServer.handleCall"></a>
191 <h4>EricJsonServer.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="EricJsonServer.handleNewConnection" ID="EricJsonServer.handleNewConnection"></a>
213 <h4>EricJsonServer.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="EricJsonServer.sendJson" ID="EricJsonServer.sendJson"></a>
220 <h4>EricJsonServer.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="EricJsonServer.startClient" ID="EricJsonServer.startClient"></a>
246 <h4>EricJsonServer.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 and the exit code
279 in case of an issue
280 </dd>
281 </dl>
282 <dl>
283 <dt>Return Type:</dt>
284 <dd>
285 bool, int
286 </dd>
287 </dl>
288 <a NAME="EricJsonServer.stopAllClients" ID="EricJsonServer.stopAllClients"></a>
289 <h4>EricJsonServer.stopAllClients</h4>
290 <b>stopAllClients</b>(<i></i>)
291
292 <p>
293 Public method to stop all clients.
294 </p>
295 <a NAME="EricJsonServer.stopClient" ID="EricJsonServer.stopClient"></a>
296 <h4>EricJsonServer.stopClient</h4>
297 <b>stopClient</b>(<i>idString=""</i>)
298
299 <p>
300 Public method to stop a client process.
301 </p>
302 <dl>
303
304 <dt><i>idString</i> (str)</dt>
305 <dd>
306 id of the client to be stopped
307 </dd>
308 </dl>
309 <div align="right"><a href="#top">Up</a></div>
310 <hr />
311 </body></html>

eric ide

mercurial