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

Qore WebSocketHandler Module Reference 1.0

- Main Page
- Related Pages
- Namespaces
- Classes

All Classes Namespaces Functions Variables Groups Pages
WebSocketHandler.qm.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3
4 /* WebSocketHandler.qm Copyright 2013 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 // this module requires Qore 0.8.11 or better
26
27 // require type definitions everywhere
28
29 // enable all warnings
30
31
32
33 /* Version History
34 * 2013-10-04 v1.0: David Nichols <david@qore.org>
35 + the initial version of the WebSocketHandler module
36 */
37
54 namespace WebSocketHandler {
57
65 class WebSocketConnection {
66
67 public:
68 public :
69 WebSocketHandler handler;
70
71 const DefaultQueuePollingInterval = 50ms;
72
73 public:
74
75 private :
77 Qore::Thread::Queue queue();
78
79 public:
80
82 constructor(WebSocketHandler handler);
83
84
86 *binary pollData();
87
88
90 *binary pollDataImmediate();
91
92
94 sendEncoded(binary msg);
95
96
98 send(data msg);
99
100
102 gotMessage(string msg);
103
104
106 gotMessage(binary msg);
107
108 };
109
111
125 class WebSocketHandler : public HttpServer::AbstractHttpSocketHandler {
126
127 public:
128 public :
129
130 public:
131
132 private :
134 RWLock rwl();
135
137 hash ch;
138
139 public:
140
142
144 constructor(*HttpServer::AbstractAuthenticator auth);
145
146
148
172 hash handleRequest(hash cx, hash hdr, *data b);
173
174
176
190 startImpl(softstring lid, hash cx, hash hdr, Qore::Socket sock);
191
192
194 WebSocketConnection getConnectionImpl(hash cx, hash hdr, string cid);
195
196
198 deregisterConnectionImpl(WebSocketConnection wsc);
199
200
202
204 sendAll(data d);
205
206
208
212 sendOne(string id, data d);
213
214
215 private sendClose(Qore::Socket sock, int code, *string txtmsg);
216
217
218 static string getDataString(*data data);
219
221 logInfo(string fmt);
222
223
225 logError(string fmt);
226
227
229 logDebug(string fmt);
230
231 };
232 };
WebSocketHandler::WebSocketConnection::pollData
*binary pollData()
this method is called by the WebSocketHandler to poll for messages from the client to send from the s...
Qore::Socket
WebSocketHandler::WebSocketConnection
this class represents a connection to a websocket client
Definition: WebSocketHandler.qm.dox.h:65
binary
binary binary()
WebSocketHandler::WebSocketConnection::pollDataImmediate
*binary pollDataImmediate()
this method is called by the WebSocketHandler to poll for messages from the client to send from the s...
HttpServer::AbstractAuthenticator
WebSocketHandler::WebSocketHandler
the main web socket handler class
Definition: WebSocketHandler.qm.dox.h:125
HttpServer::AbstractHttpSocketHandler
WebSocketHandler::WebSocketConnection::constructor
constructor(WebSocketHandler handler)
the constructor is called by the WebSocketHandler when a new connection is made by a websocket client...
Qore::Thread::Queue
WebSocketHandler::WebSocketConnection::send
send(data msg)
pushes an unencoded message on the connection's message queue; the message will be encoded with WebSo...
WebSocketHandler::WebSocketHandler::ch
hash ch
connection hash
Definition: WebSocketHandler.qm.dox.h:137
WebSocketHandler::WebSocketConnection::gotMessage
gotMessage(string msg)
this method is called by the WebSocketHandler when messages from the client are received ...
hash
hash hash(object obj)
WebSocketHandler::WebSocketConnection::queue
Qore::Thread::Queue queue()
the Queue object stored messages to be sent to the server
WebSocketHandler::WebSocketConnection::sendEncoded
sendEncoded(binary msg)
pushes an already-encoded message on the connection's message queue