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 - 2022 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}
35
93const WsSchemes = {
94 "sewiows": {
95 "ssl": False,
96 },
97 "sewiowss": {
98 "ssl": True,
99 },
100};
101
103
115class SewioWebSocketClient : public WebSocketClient::WebSocketClient {
116
117public:
119 const RequiredOptions = ...;
120
121
123 const Version = "1.0";
124
126 const DefaultUserAgent = sprintf("Qore-SewioWebSocketClient/%s", SewioWebSocketClient::Version);
127
128private:
129 // Sewio API key
130 string apikey;
131
132public:
133
135
155 constructor(code cb, hash opts) ;
156
157
159 sendData(string method, string resource, *hash h);
160
161
164
165
167protected:
168 hash connectUnlocked(*hash hdr, *reference<hash> info);
169public:
170
171
173protected:
174 static code getCallback(code cb);
175public:
176
177};
178
180
194class SewioWebSocketConnection : public WebSocketClient::WebSocketConnectionObject {
195
196public:
198 const ConnectionScheme = <ConnectionSchemeInfo>{
199 "cls": Class::forName("SewioWebSocketConnection"),
200 "options": WebSocketConnectionObject::ConnectionScheme.options + {
201 "apikey": <ConnectionOptionInfo>{
202 "type": "string",
203 "desc": "the Sewio RTLS Studio API key",
204 },
205 },
206 "required_options": foldl $1 + "," + $2, SewioWebSocketClient::RequiredOptions,
207 };
208
210 const Options = map {$1: True}, keys ConnectionScheme.options;
211
213 const DefaultOptions = ...;
214
215
217
227 constructor(string name, string description, string url, hash attributes = {}, hash options = {})
228 ;
229
230
232 string getType();
233
234
236
244protected:
245 SewioWebSocketClient getImpl(bool connect = True, *hash rtopts);
246public:
247
248
250protected:
251 hash<ConnectionSchemeInfo> getConnectionSchemeInfoImpl();
252public:
253
254};
255};
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:119
sendData(string method, string resource, *hash h)
sends data to the server
const Version
module version
Definition: SewioWebSocketClient.qm.dox.h:123
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:194
const DefaultOptions
default options
Definition: SewioWebSocketClient.qm.dox.h:213
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:198
const Options
object connection options
Definition: SewioWebSocketClient.qm.dox.h:210
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:91
const WsSchemes
known websocket schemes
Definition: SewioWebSocketClient.qm.dox.h:93