polling

At what point are WebSockets less efficient than Polling?

馋奶兔 提交于 2019-12-01 03:28:14
While I understand that the answer to the above question is somewhat determined by your application's architecture, I'm interested mostly in very simple scenarios. Essentially, if my app is pinging every 5 seconds for changes, or every minute, around when will the data being sent to maintain the open Web Sockets connection end up being more than the amount you would waste by simple polling? Basically, I'm interested in if there's a way of quantifying how much inefficiency you incur by using frameworks like Meteor if an application doesn't necessarily need real-time updates, but only periodic

Vaadin 8 : reload grid with data from server every 1min

删除回忆录丶 提交于 2019-12-01 00:04:59
I am trying to have a auto refresh feature for the grid which basically, updates the grid with latest data from the server every 'n' seconds. I was able to implement the PollListner whenever the user enables Auto-Refresh. UI ui= TestUI.getCurrent(); Boolean value = isRefreshChkBox.getValue(); PollListener listener = e -> { explorer.reloadUI(); }; if (value) { String refreshRateValue = refreshRateTxtField.getValue(); int refreshRate = Integer.valueOf(refreshRateValue); int millis = (int) TimeUnit.SECONDS.toMillis(refreshRate); absUI.setPollInterval(millis); absUI.addPollListener(listener); }

Right way to poll GMail inbox for incoming mail from stand-alone application

。_饼干妹妹 提交于 2019-11-30 16:19:51
I am trying to poll GMail inbox for incoming mail. Here is what I have: import java.util.Properties; import javax.mail.Authenticator; import javax.mail.Folder; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.event.MessageCountEvent; import javax.mail.event.MessageCountListener; import com.sun.mail.imap.IMAPFolder; import com.sun.mail.imap.IMAPStore; public class GmailIncomingTest { public static void main(String[] args) { try { String username = "my.user@gmail.com"; String password =

What's the fastest way to poll a MySQL table for new rows?

China☆狼群 提交于 2019-11-30 13:25:46
问题 My application needs to poll a MySQL database for new rows. Every time new rows are added, they should be retrieved. I was thinking of creating a trigger to place references to new rows on a separate table. The original table has over 300,000 rows. The application is built in PHP. Some good answers, i think the question deserves a bounty. 回答1: For external applications I find using a TimeStamp column is a more robust method that is independent of auto id and other primary key issues Add

Web Page update without polling

懵懂的女人 提交于 2019-11-30 10:31:17
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 (so far i know). But, this method has some defects, i see:- Since, the request will be sent every 5-10

Using the Linux sysfs_notify call

人走茶凉 提交于 2019-11-30 07:26:12
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). Unfortunately, the polling program does not work. It always returns success immediately. Interestingly, if I don

Indicate to an ajax process that the delayed job has completed

久未见 提交于 2019-11-30 06:50:22
问题 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. 回答1: Typically, the best way to do this is to store, in your database, an indication of the job's

Progress notification in WCF for long running processes - How?

余生颓废 提交于 2019-11-30 05:17:27
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. ( Pro : simple to deploy, no firewall messing around Con : Unelegant, resource consuming etc.) Use a duplex

Right way to poll GMail inbox for incoming mail from stand-alone application

感情迁移 提交于 2019-11-29 23:31:18
问题 I am trying to poll GMail inbox for incoming mail. Here is what I have: import java.util.Properties; import javax.mail.Authenticator; import javax.mail.Folder; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.event.MessageCountEvent; import javax.mail.event.MessageCountListener; import com.sun.mail.imap.IMAPFolder; import com.sun.mail.imap.IMAPStore; public class GmailIncomingTest { public

Why doesn't this call to `poll` block correctly on a sysfs device attribute file?

拜拜、爱过 提交于 2019-11-29 18:07:13
问题 I have a simple sysfs device attribute which shows up under my sysfs directory, and on a call to read returns the value of a kernelspace variable. I want to call poll on this attribute to allow my userspace thread to block until the value shown by the attribute changes. My problem is that poll doesn't seem to block on my attribute -- it keeps returning POLLPRI even though the value shown by the attribute does not change. In fact, I have no calls at all to sysfs_notify in the kernel module,