polling

Web Page update without polling

依然范特西╮ 提交于 2019-11-29 16:28:25
问题 I'm developing a web app where a user can request a service and a provider will be available to respond to him. So, When a user requests for some sort of service, our application will send a notification to the provider (asking him to respond to the user). What I'm trying to do is: when a user requests a service, the provider gets the notification instantly (something like facebook does). One way to get this is using AJAX to send requests to the server every 5-10 secs; what we call is polling

How to prevent PrimeFaces poll from clearing FacesMessages?

青春壹個敷衍的年華 提交于 2019-11-29 13:50:55
I'm using PrimeFaces poll component to refresh some content. <h:form id="formBsvtt"> <p:messages autoUpdate="true" showDetail="false" /> <p:outputPanel id="panelOut" layout="block"> ... ... content to refresh ... </p:outputPanel> <p:panelGrid id="panelIn" layout="block"> ... ... various input components with validation ... </p:panelGrid> <p:poll widgetVar="poll1" autoStart="true" global="false" interval="15" partialSubmit="true" process="@this" update="panelOut" listener="#{myBean.myListener}"> </p:poll> </h:form> As you can see I'm using messages with autoUpdate=true. My Problem is: In case

Using the Linux sysfs_notify call

元气小坏坏 提交于 2019-11-29 09:38:08
问题 I am trying to communicate asynchronously between a kernel driver and a user-space program (I know there are lots of questions here that ask for similar information, but I could find none that deal with sysfs_notify). I am leaving Vilhelm's edit here, but adding the source to both a simple driver utilizing sysfs and a user-space program to poll it. The driver works fine (I got most of it from the net; it is missing the credits, but I couldn't find them when I went back to add them).

Polling Service - C#

[亡魂溺海] 提交于 2019-11-29 05:14:33
Will anobody be able to help me? I am creating a windows service that connects to a sql database and checks a date in the table and compares it to todays date and updates a field in that database for eg if the date is equal to todays date then the field will be set to true. The problem I am having is that when i start the service it does not do that but when i do it in a normal form it works perfectly. My code is below: //System.Timers Timer timer = new Timer(); protected override void OnStart(string[] args) { timer.Elapsed += new ElapsedEventHandler(OnElapsedTime); timer.Interval = 60000;

How to reset timeout in Javascript/jQuery?

吃可爱长大的小学妹 提交于 2019-11-29 03:41:04
I've got a field A in my webpage which, when edited by the user, invokes an API call (using jQuery), which updates field B. After the edit, the API should be called every 10 seconds to update the field B again. I currently do this using: setTimeout(thisFunction, 10000); The problem is that this timeout is set every time the user edits field A, which after editing field A a couple times causes the timeout to be set multiple times and the API to be called many many times. This makes the website look pretty stressy. What I would rather like to do, is set a new timeout every time the field is

Progress notification in WCF for long running processes - How?

社会主义新天地 提交于 2019-11-29 03:16:42
问题 I have to design and implement a way to deal with long running processes in a client/server application. A typical long running process would/could take 2-3 minutes. I also need to report progress to the UI in the meantime and keep the UI responsive. Having these in my mind I though of a few solutions: One async request to start the process which starts the server-side process and returns an assigned LRPID (Long Running Process ID) then poll periodically from the client using that LRPID. (

How To Do Polling with Angular 2 Observables

天涯浪子 提交于 2019-11-28 23:18:38
Given the following code, how to I alter it to make the get request to "api/foobar" repeat every 500 milliseconds? import {Observable} from "RxJS/Rx"; import {Injectable} from "@angular/core"; import {Http} from "@angular/http"; @Injectable() export class ExampleService { constructor(private http: Http) { } getFooBars(onNext: (fooBars: FooBar[]) => void) { this.get("api/foobar") .map(response => <FooBar[]>reponse.json()) .subscribe(onNext, error => console.log("An error occurred when requesting api/foobar.", error)); } } make sure you have imported import {Observable} from 'rxjs/Rx' if we don

Using setInterval() to do simplistic continuous polling

微笑、不失礼 提交于 2019-11-28 22:35:20
For a simple webapp that needs to refresh parts of data presented to the user in set intervals, are there any downsides to just using setInterval() to get a JSON from an endpoint instead of using a proper polling framework? For the sake of the example, lets say I'm refreshing status of a processing job every 5 seconds. From my comment: I would use setTimeout [docs] and always call it when the previous response was received. This way you avoid possible congestion or function stacking or whatever you want to call it, in case a request/response takes longer than your interval. So something like

Indicate to an ajax process that the delayed job has completed

元气小坏坏 提交于 2019-11-28 21:52:15
I have a Rails 3 app that uses delayed_job to fetch some data (with a class method) when the user hits the page. How can I indicate to the ajax process that the class method has run (so that I can stop polling)? EDIT: To clarify, I want to know when the delayed_job has run, not when the ajax process has succeeded. Then I want to pass the delayed_job completed status to the running ajax process. Typically, the best way to do this is to store, in your database, an indication of the job's progress. For instance: class User def perform_calculation begin self.update_attributes :calculation_status =

What is the difference between busy-wait and polling?

て烟熏妆下的殇ゞ 提交于 2019-11-28 20:50:09
From the Wikipedia article on Polling Polling, or polled operation, in computer science, refers to actively sampling the status of an external device by a client program as a synchronous activity. Polling is most often used in terms of input/output (I/O), and is also referred to as polled I/O or software driven I/O. Polling is sometimes used synonymously with busy-wait polling (busy waiting). In this situation, when an I/O operation is required the computer does nothing other than check the status of the I/O device until it is ready, at which point the device is accessed. In other words the