Qore WebSocketClient Module Reference: doxygen/qlib/WebSocketClient.qm.dox.h Source File

Qore WebSocketClient Module Reference 1.2

- Main Page
- Related Pages
- Namespaces
- Classes

All Classes Namespaces Functions Variables Groups Pages
WebSocketClient.qm.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3
4 /* WebSocketClient.qm Copyright 2013 - 2014 Qore Technologies, sro
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24
25 // minimum required Qore version
26
27 // require type definitions everywhere
28
29 // enable all warnings
30
31
32
33 /* Version History
34 * 2014-03-14 v1.2: David Nichols <david@qore.org>
35 + prepend "WebSocketClient: " to log messages
36
37 * 2014-02-04 v1.1: David Nichols <david@qore.org>
38 + added socket instrumention support from Qore 0.8.9
39
40 * 2013-10-04 v1.0: David Nichols <david@qore.org>
41 + the initial version of the WebSocketClient module
42 */
43
82 namespace WebSocketClient {
85 const WsSchemes = (
86 "ws": (
87 "ssl": False,
88 ),
89 "wss": (
90 "ssl": True,
91 ),
92 );
93
95 const WsDefaultPort = 80;
96
98
104 class WebSocketClient {
105
106 public:
107 private :
108 Mutex m();
109 HTTPClient hc();
110 int stop = 0;
111 Counter c();
112 code callback;
113 *code log;
114 *code errlog;
115 *code debuglog;
116 timeout timeout_ms = DefaultTimeout;
117
118 public:
119
120 public :
121 const DefaultTimeout = 15s;
122
123 const Version = "1.0";
124
125 const DefaultUserAgent = sprintf("Qore-WebSocketClient/%s", WebSocketClient::Version);
126
127 public:
128
130
149 constructor(code callback, hash opts);
150
151
153
179 hash connect(*hash opts, *reference info);
180
181
183 bool isOpen();
184
185
187 disconnect(int cmd = WSCC_GoingAway);
188
189
191
200 nothing clearWarningQueue();
201
202
204
234 nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, any arg, timeout min_ms = 1s);
235
236
238
256 hash getUsageInfo();
257
258
260
269 clearStats();
270
271
272 private disconnectUnlocked(int cmd = WSCC_GoingAway);
273
274
275 private eventLoop(code callback);
276
277
278 private logInfo(string fmt);
279
280
281 private logError(string fmt);
282
283
284 private logDebug(string fmt);
285
286
287 private sendClose(int code, *string txtmsg);
288
289
290 private hash connectUnlocked(*hash hdr, *reference info);
291
292
293 send(string str);
294
295
296 send(binary bin);
297
298 };
299 };
WSCC_GoingAway
const WSCC_GoingAway
sprintf
string sprintf(string fmt,...)
WebSocketClient::WsSchemes
const WsSchemes
known websocket schemes
Definition: WebSocketClient.qm.dox.h:85
True
const True
binary
binary binary()
WebSocketClient::WsDefaultPort
const WsDefaultPort
default port for connections
Definition: WebSocketClient.qm.dox.h:95
False
const False
WebSocketClient::WebSocketClient
the main websocket client class
Definition: WebSocketClient.qm.dox.h:104
hash
hash hash(object obj)