Qore WebSocketHandler Module Reference  1.2
WebSocketHandler.qm.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3 
4 /* WebSocketHandler.qm Copyright 2013 - 2016 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 // this module requires Qore 0.8.12 or better
26 
27 // require type definitions everywhere
28 
29 // enable all warnings
30 
31 
32 
33 
64 namespace WebSocketHandler {
67 
76 
77 public:
78  public :
79  WebSocketHandler handler;
80 
81  const DefaultQueuePollingInterval = 50ms;
82 
83 public:
84 
85  private :
88 
89 public:
90 
92  constructor(WebSocketHandler n_handler);
93 
94 
96  *binary pollData();
97 
98 
101 
102 
104  sendEncoded(binary msg);
105 
106 
108  send(data msg);
109 
110 
112 
114  gotMessage(string msg);
115 
116 
118 
120  gotMessage(binary msg);
121 
122 
124 
127 
128  };
129 
131 
146 
147 public:
148  public :
149 
150 public:
151 
152  private :
154  RWLock rwl();
155 
158 
159 public:
160 
162 
164  constructor(*HttpServer::AbstractAuthenticator auth) ;
165 
166 
168 
192  hash handleRequest(hash cx, hash hdr, *data b);
193 
194 
196 
210  startImpl(softstring lid, hash cx, hash hdr, Qore::Socket sock);
211 
212 
214  WebSocketConnection getConnectionImpl(hash cx, hash hdr, string cid);
215 
216 
218  deregisterConnectionImpl(WebSocketConnection wsc);
219 
220 
222 
224  sendAll(data d);
225 
226 
228 
232  sendOne(string id, data d);
233 
234 
235  private sendClose(Qore::Socket sock, int code, *string txtmsg);
236 
237 
238  static string getDataString(*data data);
239 
241  logInfo(string fmt);
242 
243 
245  logError(string fmt);
246 
247 
249  logDebug(string fmt);
250 
251  };
252 };
*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:75
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:65
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:157
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