Qore WebSocketClient Module Reference  1.3
WebSocketClient.qm.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3 
4 /* WebSocketClient.qm Copyright 2013 - 2015 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 
88 namespace WebSocketClient {
91  const WsSchemes = (
92  "ws": (
93  "ssl": False,
94  ),
95  "wss": (
96  "ssl": True,
97  ),
98  );
99 
101  const WsDefaultPort = 80;
102 
104 
111 
112 public:
113  private :
114  Mutex m();
115  HTTPClient hc();
116  int stop = 0;
117  Counter c();
118  code callback;
119  *code log;
120  *code errlog;
121  *code debuglog;
122  timeout timeout_ms = DefaultTimeout;
123 
124 public:
125 
126  public :
127  const DefaultTimeout = 15s;
128 
129  const Version = "1.0";
130 
131  const DefaultUserAgent = sprintf("Qore-WebSocketClient/%s", WebSocketClient::Version);
132 
133 public:
134 
136 
155  constructor(code cb, hash opts);
156 
157 
159 
185  hash connect(*hash opts, *reference info);
186 
187 
189  bool isOpen();
190 
191 
193  disconnect(int cmd = WSCC_GoingAway);
194 
195 
197 
206  nothing clearWarningQueue();
207 
208 
210 
240  nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, any arg, timeout min_ms = 1s);
241 
242 
244 
262  hash getUsageInfo();
263 
264 
266 
275  clearStats();
276 
277 
278  private disconnectUnlocked(int cmd = WSCC_GoingAway);
279 
280 
281  private eventLoop(code callback);
282 
283 
284  private logInfo(string fmt);
285 
286 
287  private logError(string fmt);
288 
289 
290  private logDebug(string fmt);
291 
292 
293  private sendClose(int code, *string txtmsg);
294 
295 
296  private hash connectUnlocked(*hash hdr, *reference info);
297 
298 
299  send(string str);
300 
301 
302  send(binary bin);
303 
304  };
305 };
const WSCC_GoingAway
string sprintf(string fmt,...)
const WsSchemes
known websocket schemes
Definition: WebSocketClient.qm.dox.h:91
const True
binary binary()
const WsDefaultPort
default port for connections
Definition: WebSocketClient.qm.dox.h:101
const False
the WebSocketClient namespace contains all the definitions in the WebSocketClient module ...
Definition: WebSocketClient.qm.dox.h:89
hash hash(object obj)