Hello,
I have been wrestling with a cppcms-problem all day and find myself out of
options. Relevant sources are included.
I'm controlling a robot via a web-interface and always have a single user.
The robot reports status to the browser via SSE which is working fine. The
robot-thread reports status-strings via boost/signal2 to the
StatusStreamServer which sents events to a webpage where I can see them.
There is another stream I use when a new usb-device is discovered or lost
(via the udev library). That also results in a boost-signal but now to the
DeviceManagementStreamServer. This results in a modal popup in the browser.
If the popup is closed by the user, the page is reloaded via
location.reload(true) to accommodate for the new or removed usbdevice (menu
is changed with new or removed options). And that repeats the last
SSE-event for some reason, which results in the same popup again.
I want is to be able to clear SSE events that have been sent but can't
figure out how to do that. Who knows how to do this?
Furthermore I notice that connections are lost about every 30 seconds,
which seems to be some regulated timeout. Where is that configured? The
other thing I notice is that sometimes SSE events are sent without content
and without me initiating them. Where do these come from?
Any help is welcome.
Both StreamServers are created like this:
// Device Management Stream
booster::intrusive_ptr<StreamServer> deviceManagementStreamServer =
new DeviceManagementStreamServer(service, "DeviceManagementStreamServer");
deviceManagementStreamServer->connectSlot();
service.applications_pool().mount(deviceManagementStreamServer,
cppcms::mount_point("/device_management_stream"));
// Status Stream
booster::intrusive_ptr<StreamServer> statusStreamServer = new
StatusStreamServer(service, "StatusStreamServer");
statusStreamServer->connectSlot();
service.applications_pool().mount(statusStreamServer,
cppcms::mount_point("/status_stream"));
Kind regards,
Eric
|