Qore ServerSentEventHandler Module Reference 1.0
Loading...
Searching...
No Matches
ServerSentEventConnection.qc.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* ServerSentEventConnection.qc Copyright 2025 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
28
38
39public:
42
44 string cid;
45
47 bool stop_flag = False;
48
49 // wait a maximum of 1/4 second for data
50 const DefaultQueuePollingInterval = 250ms;
51
52protected:
54 Qore::Thread::Queue queue();
55
57 int tid = gettid();
58
59public:
60
61private:
63 Socket sock;
64
65public:
66
68
73
74
76
78 *string pollData();
79
80
82
85
86
88 sendEncoded(string msg);
89
90
92
94 send(hash<SseMessageInfo> msg);
95
96
98
103
104
106
111
112
114
118
119
122
123};
124};
this class represents a connection to an HTTP client
Definition ServerSentEventConnection.qc.dox.h:37
connectionClosed()
This method is called when the connection is closed.
*string pollData()
This method is called to poll for messages from the client to send from the server.
sendEncoded(string msg)
Pushes an already-encoded message on the connection's message queue.
stop()
force closing socket related to connection
string cid
The connection ID.
Definition ServerSentEventConnection.qc.dox.h:44
*string pollDataImmediate()
This method is called to poll for messages from the client to send from the server.
Qore::Thread::Queue queue()
the Queue object stores messages to be sent to the server
int tid
The TID of the I/O thread.
Definition ServerSentEventConnection.qc.dox.h:57
send(hash< SseMessageInfo > msg)
Pushes an unencoded message on the connection's message queue.
ServerSentEventHandler handler
The parent handler object.
Definition ServerSentEventConnection.qc.dox.h:41
bool stop_flag
Stop connection flag.
Definition ServerSentEventConnection.qc.dox.h:47
Socket sock
The socket used by the server for this connection.
Definition ServerSentEventConnection.qc.dox.h:63
registered()
Called when the connection has been registered in handler and accept sending messages.
constructor(ServerSentEventHandler handler, Socket sock, string cid)
the constructor is called when a new connection is made by an HTTP client
the ServerSentEventHandler namespace contains all the objects in the ServerSentEventHandler module
Definition ServerSentEventConnection.qc.dox.h:26