Qore WebSocketHandler Module Reference  1.1
WebSocketHandler.qm.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3 
4 /* WebSocketHandler.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 // this module requires Qore 0.8.12 or better
26 
27 // require type definitions everywhere
28 
29 // enable all warnings
30 
31 
32 
33 
61 namespace WebSocketHandler {
64 
73 
74 public:
75  public :
76  WebSocketHandler handler;
77 
78  const DefaultQueuePollingInterval = 50ms;
79 
80 public:
81 
82  private :
85 
86 public:
87 
89  constructor(WebSocketHandler n_handler);
90 
91 
93  *binary pollData();
94 
95 
98 
99 
101  sendEncoded(binary msg);
102 
103 
105  send(data msg);
106 
107 
109 
111  gotMessage(string msg);
112 
113 
115 
117  gotMessage(binary msg);
118 
119 
121 
124 
125  };
126 
128 
143 
144 public:
145  public :
146 
147 public:
148 
149  private :
151  RWLock rwl();
152 
155 
156 public:
157 
159 
161  constructor(*HttpServer::AbstractAuthenticator auth) ;
162 
163 
165 
189  hash handleRequest(hash cx, hash hdr, *data b);
190 
191 
193 
207  startImpl(softstring lid, hash cx, hash hdr, Qore::Socket sock);
208 
209 
211  WebSocketConnection getConnectionImpl(hash cx, hash hdr, string cid);
212 
213 
215  deregisterConnectionImpl(WebSocketConnection wsc);
216 
217 
219 
221  sendAll(data d);
222 
223 
225 
229  sendOne(string id, data d);
230 
231 
232  private sendClose(Qore::Socket sock, int code, *string txtmsg);
233 
234 
235  static string getDataString(*data data);
236 
238  logInfo(string fmt);
239 
240 
242  logError(string fmt);
243 
244 
246  logDebug(string fmt);
247 
248  };
249 };
*binary pollData()
this method is called by the WebSocketHandler to poll for messages from the client to send from the s...
this class represents a connection to a websocket client
Definition: WebSocketHandler.qm.dox.h:72
binary binary()
*binary pollDataImmediate()
this method is called by the WebSocketHandler to poll for messages from the client to send from the s...
connectionClosed()
this method is called by the WebSocketHandler when the connection is closed
the WebSocketHandler namespace contains all the objects in the WebSocketHandler module ...
Definition: WebSocketHandler.qm.dox.h:62
send(data msg)
pushes an unencoded message on the connection's message queue; the message will be encoded with WebSo...
hash ch
connection hash
Definition: WebSocketHandler.qm.dox.h:154
gotMessage(string msg)
this method is called by the WebSocketHandler when messages from the client are received ...
hash hash(object obj)
Qore::Thread::Queue queue()
the Queue object stores messages to be sent to the server
constructor(WebSocketHandler n_handler)
the constructor is called by the WebSocketHandler when a new connection is made by a websocket client...
sendEncoded(binary msg)
pushes an already-encoded message on the connection's message queue