What I want to achieve is
Server Side (WCF Service with JSON or ASP.NET page (i dont know what I need yet))
- Check for latest data over an HTTP request from an existing page periodically. (This is a dynamic page and does not know I am there so it can not send updates.)
- If anything changed on that page send post request to Google Cloud Messaging system that there is a new data
- Clients already registered get notified and get the payload data which is smaller than 4 KB.
Question is #1 how do i check for new data periodically on server side? If that was an desktop app sure I would use a Timer.
Im stuck at this point. Can you please let me know what you think it should be like
Thanks
When do you mean by “Check for latest data over an HTTP request from an existing page”? Is it your page, or someone else’s? Also, why do you think your code needs to be within a WCF service or ASP.NET page? From what you’ve told so far, this sounds like a regular executable. Let’s recap what it would do:
Neither task involves serving up Web pages. If this piece of code needs to interact with a website somehow, that’s OK; but it doesn’t have to be a part of the said website. It can, but it does not have to.
That said, running scheduled tasks purely within a Web server environment is tricky, bordering on impossible. There are multiple scheduling facilities out there (Windows Task Scheduler comes to one’s mind first) – but they are mostly geared executing programs – that is, standalone programs, EXE’s. If you absolutely have to run this code within a Web server, you can write something executable standalone (e. g. in JavaScript using XMLHTTPRequest, or a cURL invokation) that would cause an HTTP request to the local Web server, and schedule invokation of the said script in Task Scheduler.
EDIT: the scheduling itself can’t and shouldn’t be Web-based. The scheduling engine is external to the Web service – most hosting providers would offer such a service, on top of the Windows Task Scheduler. Check your server’s administrative interface (CPanel, RDP or what have you).
Anyway, to call a Web page from a scheduler, schedule the following command:
Where CallWeb.js goes like this:
Where mypage.aspx is the page that pulls SonDepremler.aspx, parses, detects changes, and sends the GCM’s.
This is the answer to your question #1 – how can you do some scheduled processing in a hosted Web server environment. If you’re stuck with other parts of the solution, please ask separate questions.