Qore SewioWebSocketClient Module Reference 1.2
Loading...
Searching...
No Matches
SewioWebSocketClient.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* SewioWebSocketClient.qm Copyright 2013 - 2023 Qore Technologies, s.r.o.
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
34
92const WsSchemes = {
93 "sewiows": {
94 "ssl": False,
95 },
96 "sewiowss": {
97 "ssl": True,
98 },
99};
100
102
115
116public:
118 const RequiredOptions = ...;
119
120
122 const Version = "1.0";
123
125 const DefaultUserAgent = sprintf("Qore-SewioWebSocketClient/%s", SewioWebSocketClient::Version);
126
127private:
128 // Sewio API key
129 string apikey;
130
131public:
132
134
154 constructor(code cb, hash opts) ;
155
156
158 sendData(string method, string resource, *hash h);
159
160
163
164
166protected:
167 hash connectUnlocked(*hash hdr, *reference<hash> info);
168public:
169
170
172protected:
173 static code getCallback(code cb);
174public:
175
176};
177
179
194
195public:
197 const ConnectionScheme = <ConnectionSchemeInfo>{
198 "cls": Class::forName("SewioWebSocketConnection"),
199 "options": WebSocketConnectionObject::ConnectionScheme.options + {
200 "apikey": <ConnectionOptionInfo>{
201 "type": "string",
202 "desc": "the Sewio RTLS Studio API key",
203 },
204 },
205 "required_options": foldl $1 + "," + $2, SewioWebSocketClient::RequiredOptions,
206 };
207
209 const Options = map {$1: True}, keys ConnectionScheme.options;
210
212
222 constructor(string name, string description, string url, hash attributes = {}, hash options = {})
223 ;
224
225
227 string getType();
228
229
231
239protected:
240 SewioWebSocketClient getImpl(bool connect = True, *hash rtopts);
241public:
242
243
245protected:
246 hash<ConnectionSchemeInfo> getConnectionSchemeInfoImpl();
247public:
248
249};
250};
hash connectUnlocked(*hash hdr, *reference< hash > info)
connects to the target server and starts the event listener thread
constructor(code cb, hash opts)
creates the object and optionally sets logging targets
const RequiredOptions
required options
Definition: SewioWebSocketClient.qm.dox.h:118
sendData(string method, string resource, *hash h)
sends data to the server
const Version
module version
Definition: SewioWebSocketClient.qm.dox.h:122
static code getCallback(code cb)
extern callback wrapper to parse the JSON and call the user's callback with the deserialized data
hash getSchemes()
returns a hash of URL scheme information for URL schemes supported by this object
class for Sewio RTLS Studio websocket connections; returns an object of class SewioWebSocketClient fo...
Definition: SewioWebSocketClient.qm.dox.h:193
constructor(string name, string description, string url, hash attributes={}, hash options={})
creates the SewioWebSocketConnection connection object
hash< ConnectionSchemeInfo > getConnectionSchemeInfoImpl()
Returns the ConnectionSchemeInfo hash for this object.
const ConnectionScheme
Connection entry info.
Definition: SewioWebSocketClient.qm.dox.h:197
const Options
object connection options
Definition: SewioWebSocketClient.qm.dox.h:209
SewioWebSocketClient getImpl(bool connect=True, *hash rtopts)
returns a SewioWebSocketClient object
the SewioWebSocketClient namespace contains all the definitions in the SewioWebSocketClient module
Definition: SewioWebSocketClient.qm.dox.h:90
const WsSchemes
known websocket schemes
Definition: SewioWebSocketClient.qm.dox.h:92