|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>Plugin_Refactoring_Rope.RefactoringRope.JsonServer</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><a NAME="top" ID="top"></a> |
|
22 <h1>Plugin_Refactoring_Rope.RefactoringRope.JsonServer</h1> |
|
23 <p> |
|
24 Module implementing the JSON based server base class. |
|
25 </p> |
|
26 <h3>Global Attributes</h3> |
|
27 <table> |
|
28 <tr><td>None</td></tr> |
|
29 </table> |
|
30 <h3>Classes</h3> |
|
31 <table> |
|
32 <tr> |
|
33 <td><a href="#JsonServer">JsonServer</a></td> |
|
34 <td>Class implementing the JSON based server base class.</td> |
|
35 </tr> |
|
36 </table> |
|
37 <h3>Functions</h3> |
|
38 <table> |
|
39 <tr><td>None</td></tr> |
|
40 </table> |
|
41 <hr /><hr /> |
|
42 <a NAME="JsonServer" ID="JsonServer"></a> |
|
43 <h2>JsonServer</h2> |
|
44 <p> |
|
45 Class implementing the JSON based server base class. |
|
46 </p> |
|
47 <h3>Derived from</h3> |
|
48 QTcpServer |
|
49 <h3>Class Attributes</h3> |
|
50 <table> |
|
51 <tr><td>None</td></tr> |
|
52 </table> |
|
53 <h3>Class Methods</h3> |
|
54 <table> |
|
55 <tr><td>None</td></tr> |
|
56 </table> |
|
57 <h3>Methods</h3> |
|
58 <table> |
|
59 <tr> |
|
60 <td><a href="#JsonServer.__init__">JsonServer</a></td> |
|
61 <td>Constructor</td> |
|
62 </tr><tr> |
|
63 <td><a href="#JsonServer.__handleDisconnect">__handleDisconnect</a></td> |
|
64 <td>Private slot handling a disconnect of the client.</td> |
|
65 </tr><tr> |
|
66 <td><a href="#JsonServer.__receiveJson">__receiveJson</a></td> |
|
67 <td>Private slot handling received data from the client.</td> |
|
68 </tr><tr> |
|
69 <td><a href="#JsonServer.connectionNames">connectionNames</a></td> |
|
70 <td>Public method to get the list of active connection names.</td> |
|
71 </tr><tr> |
|
72 <td><a href="#JsonServer.handleCall">handleCall</a></td> |
|
73 <td>Public method to handle a method call from the client.</td> |
|
74 </tr><tr> |
|
75 <td><a href="#JsonServer.handleNewConnection">handleNewConnection</a></td> |
|
76 <td>Public slot for new incoming connections from a client.</td> |
|
77 </tr><tr> |
|
78 <td><a href="#JsonServer.sendJson">sendJson</a></td> |
|
79 <td>Public method to send a single command to a client.</td> |
|
80 </tr><tr> |
|
81 <td><a href="#JsonServer.startClient">startClient</a></td> |
|
82 <td>Public method to start a client process.</td> |
|
83 </tr><tr> |
|
84 <td><a href="#JsonServer.stopAllClients">stopAllClients</a></td> |
|
85 <td>Public method to stop all clients.</td> |
|
86 </tr><tr> |
|
87 <td><a href="#JsonServer.stopClient">stopClient</a></td> |
|
88 <td>Public method to stop a client process.</td> |
|
89 </tr> |
|
90 </table> |
|
91 <h3>Static Methods</h3> |
|
92 <table> |
|
93 <tr><td>None</td></tr> |
|
94 </table> |
|
95 <a NAME="JsonServer.__init__" ID="JsonServer.__init__"></a> |
|
96 <h4>JsonServer (Constructor)</h4> |
|
97 <b>JsonServer</b>(<i>name="", multiplex=False, parent=None</i>) |
|
98 <p> |
|
99 Constructor |
|
100 </p><dl> |
|
101 <dt><i>name</i> (str)</dt> |
|
102 <dd> |
|
103 name of the server (used for output only) |
|
104 </dd><dt><i>multiplex</i> (bool)</dt> |
|
105 <dd> |
|
106 flag indicating a multiplexing server |
|
107 </dd><dt><i>parent</i> (QObject)</dt> |
|
108 <dd> |
|
109 parent object |
|
110 </dd> |
|
111 </dl><a NAME="JsonServer.__handleDisconnect" ID="JsonServer.__handleDisconnect"></a> |
|
112 <h4>JsonServer.__handleDisconnect</h4> |
|
113 <b>__handleDisconnect</b>(<i>idString</i>) |
|
114 <p> |
|
115 Private slot handling a disconnect of the client. |
|
116 </p><dl> |
|
117 <dt><i>idString</i> (str)</dt> |
|
118 <dd> |
|
119 id of the connection been disconnected |
|
120 </dd> |
|
121 </dl><a NAME="JsonServer.__receiveJson" ID="JsonServer.__receiveJson"></a> |
|
122 <h4>JsonServer.__receiveJson</h4> |
|
123 <b>__receiveJson</b>(<i>idString</i>) |
|
124 <p> |
|
125 Private slot handling received data from the client. |
|
126 </p><dl> |
|
127 <dt><i>idString</i> (str)</dt> |
|
128 <dd> |
|
129 id of the connection been disconnected |
|
130 </dd> |
|
131 </dl><a NAME="JsonServer.connectionNames" ID="JsonServer.connectionNames"></a> |
|
132 <h4>JsonServer.connectionNames</h4> |
|
133 <b>connectionNames</b>(<i></i>) |
|
134 <p> |
|
135 Public method to get the list of active connection names. |
|
136 </p><p> |
|
137 If this is not a multiplexing server, an empty list is returned. |
|
138 </p><dl> |
|
139 <dt>Returns:</dt> |
|
140 <dd> |
|
141 list of active connection names |
|
142 </dd> |
|
143 </dl><dl> |
|
144 <dt>Return Type:</dt> |
|
145 <dd> |
|
146 list of str |
|
147 </dd> |
|
148 </dl><a NAME="JsonServer.handleCall" ID="JsonServer.handleCall"></a> |
|
149 <h4>JsonServer.handleCall</h4> |
|
150 <b>handleCall</b>(<i>method, params</i>) |
|
151 <p> |
|
152 Public method to handle a method call from the client. |
|
153 </p><p> |
|
154 Note: This is an empty implementation that must be overridden in |
|
155 derived classes. |
|
156 </p><dl> |
|
157 <dt><i>method</i> (str)</dt> |
|
158 <dd> |
|
159 requested method name |
|
160 </dd><dt><i>params</i> (dict)</dt> |
|
161 <dd> |
|
162 dictionary with method specific parameters |
|
163 </dd> |
|
164 </dl><a NAME="JsonServer.handleNewConnection" ID="JsonServer.handleNewConnection"></a> |
|
165 <h4>JsonServer.handleNewConnection</h4> |
|
166 <b>handleNewConnection</b>(<i></i>) |
|
167 <p> |
|
168 Public slot for new incoming connections from a client. |
|
169 </p><a NAME="JsonServer.sendJson" ID="JsonServer.sendJson"></a> |
|
170 <h4>JsonServer.sendJson</h4> |
|
171 <b>sendJson</b>(<i>command, params, flush=False, idString=""</i>) |
|
172 <p> |
|
173 Public method to send a single command to a client. |
|
174 </p><dl> |
|
175 <dt><i>command</i> (str)</dt> |
|
176 <dd> |
|
177 command name to be sent |
|
178 </dd><dt><i>params</i> (dict)</dt> |
|
179 <dd> |
|
180 dictionary of named parameters for the command |
|
181 </dd><dt><i>flush</i> (bool)</dt> |
|
182 <dd> |
|
183 flag indicating to flush the data to the socket |
|
184 </dd><dt><i>idString</i> (str)</dt> |
|
185 <dd> |
|
186 id of the connection to send data to |
|
187 </dd> |
|
188 </dl><a NAME="JsonServer.startClient" ID="JsonServer.startClient"></a> |
|
189 <h4>JsonServer.startClient</h4> |
|
190 <b>startClient</b>(<i>interpreter, clientScript, clientArgs, idString=""</i>) |
|
191 <p> |
|
192 Public method to start a client process. |
|
193 </p><dl> |
|
194 <dt><i>interpreter</i> (str)</dt> |
|
195 <dd> |
|
196 interpreter to be used for the client |
|
197 </dd><dt><i>clientScript</i> (str)</dt> |
|
198 <dd> |
|
199 path to the client script |
|
200 </dd><dt><i>clientArgs</i></dt> |
|
201 <dd> |
|
202 list of arguments for the client |
|
203 </dd><dt><i>idString</i> (str)</dt> |
|
204 <dd> |
|
205 id of the client to be started |
|
206 </dd> |
|
207 </dl><dl> |
|
208 <dt>Returns:</dt> |
|
209 <dd> |
|
210 flag indicating a successful client start |
|
211 </dd> |
|
212 </dl><dl> |
|
213 <dt>Return Type:</dt> |
|
214 <dd> |
|
215 bool |
|
216 </dd> |
|
217 </dl><a NAME="JsonServer.stopAllClients" ID="JsonServer.stopAllClients"></a> |
|
218 <h4>JsonServer.stopAllClients</h4> |
|
219 <b>stopAllClients</b>(<i></i>) |
|
220 <p> |
|
221 Public method to stop all clients. |
|
222 </p><a NAME="JsonServer.stopClient" ID="JsonServer.stopClient"></a> |
|
223 <h4>JsonServer.stopClient</h4> |
|
224 <b>stopClient</b>(<i>idString=""</i>) |
|
225 <p> |
|
226 Public method to stop a client process. |
|
227 </p><dl> |
|
228 <dt><i>idString</i> (str)</dt> |
|
229 <dd> |
|
230 id of the client to be stopped |
|
231 </dd> |
|
232 </dl> |
|
233 <div align="right"><a href="#top">Up</a></div> |
|
234 <hr /> |
|
235 </body></html> |