Re: [Cppcms-users] (no subject)
Brought to you by:
artyom-beilis
From: Marcel H. <ke...@co...> - 2014-02-20 12:12:15
|
On 20.02.2014 05:12, eric middelkoop wrote: > Hello, > > I am looking for a way to update parts of a webpage via events from the > server. > > I downloaded the Ticker example from the blog but as I try to compile it > (os = Ubuntu) I'm getting the following errors: which version of gcc do you using? > g++ -std=c++0x -O2 -Wall -g ticker.cpp -o ticker -lcppcms -lbooster > ticker.cpp: In member function ‘void > ticker::async_send(booster::shared_ptr<cppcms::http::context>)’: > ticker.cpp:83:39: error: capture of non-variable ‘ticker::counter_’ > ticker.cpp:97:9: note: ‘int ticker::counter_’ declared here fun fact: ticker.cpp has only 76 lines :) Which version of the ticker are you using? The latest from svn trunk? > > I also downloaded the Sse Ticker example from contrib and that does > compile but when I run it and access the page from firefox > (127.0.0.1:8080/ticker <http://127.0.0.1:8080/ticker>), I get a 404 Not > Found and a popup with the following information: hmm. I think you mess up things. 404 really means nothing, but firefox has a file which will be presented to you. > > ------------------------------------------------------- > ticker > which is: text/event-stream > from: http://127.0.0.1:8080 > > What should firefox do with this file? > - Open with Browse > - Save File > -------------------------------------------------------- > > It doesn't display the tickers on the webpage. Yep, that's right, but that's what the ticker does. It does not have a page to display, but emits events the whole time to a stream. To view the content you can use this: > wget localhost:8080/ticker -qO - | cat > > I have a camera that is shooting photographs and want a webpage to > reflect what the camera is doing. So every time it shoots a photograph > the webserver should send the filename and sequencenumber of that > photograph to the webpage and the user must be able to inform the camera > to stop taking pictures via pressing a button. You need a webpage that does some magic javascript and a backend. That shouldn't be that hard. > So HTTP requests to > control the camera and asynchronous status-updates to be displayed on > the webpage. > > I hope someone can help me out by either getting one of the ticker > examples working or providing another working example. As I said. Everything works in the way that it should be. Maybe the chat example is more for you :) > > Many thanks! > > Eric > > Greetings Marcel |