As part of my research on web usage, I have people install a Firefox addon to track their visits (kinda like RescueTime, but different for my research).
So I worry whether the users cheat by uninstalling the addon. Is there any way I can have the addon notify me on install/uninstall of the addon?
I know there's a bunch of workarounds for this (say, just by using another browser client). But what can I do for this very specific case?
PS - I have the same question for a Chrome extenion that does pretty much the same thing. I assume I should start another thread to ask that question.
You can register an observer for the em-action-requested topic: https://developer.mozilla.org/en/Observer_Notifications#Extension_Manager. This way you can get notified whenever the user chooses to uninstall your add-on. There is a number of limitations here:
Disabled add-ons don't get notified (they aren't active). You can get notified whenever the user chooses to disable your add-on however.
Most add-ons aren't uninstalled immediately, usually this requires a browser restart. Until that restart the user can still choose to revert his action.
Add-ons can be uninstalled while the browser isn't running, simply by removing the corresponding directory/file. No notification will be sent then.
It might be more reliable to send a regular "I am alive" signal to your server if you want to verify that the add-on is still installed.
For Firefox 4.0 and greater you can use the new AddonManager interface. Call the addAddonListener() method to pass in your listener. Implement the methods on your listener as documented, including onUninstalling() and/or onUninstalled().
Related
I posted another question as a brute-force solution to this one (Angular: fully install service worker before anything else) but I thought I'd make a separate one to discuss the use case for when a service worker is used as intended.
According to the service worker life cycle (https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle), the SW is installed but it's only active once you then reload the page (you can claim() the page but that's only for calls that happen after the service worker is installed). The reasoning is that if and existing version is updated, the old one and the new one do not mix states and caches. I can agree with that decision.
What I have trouble understanding is why it is not immediately active once it is initially installed. Instead, it requires a page reload unless you explicitly define precaching rules in the SW. If you define caching rules with wildcards, it's not possible to precache those so you need the reload.
Given a single page PWA (like Angular), a user will discover the site and browser around on it but the page will never be reloaded during that session. If they then want to use the site offline later, they need to have refreshed or re-opened the tab at least one other time. That seems like a pretty big pitfall to me.
Am I missing something here?
Your understanding of the service worker lifecycle is correct but I do not think the pitfall you mentioned is as severe as you think it is.
If I understand you correctly, the user experience will only be negatively affected if the user loses connectivity during the initial browsing of the page (before the service worker is active) and is missing an offline asset. If this is truly a scenario you want to account for then that offline asset can be pre-cached in the browser-side javascript. Alternatively, as you mentioned, you can skipWaiting() and claim() to make the service worker active without the user refreshing the page.
I wrote and deployed a program to install ServiceWorker.
However, the overall performance of the service has fallen due to the ServiceWorker.
So, I decided to remove ServiceWorker from that service.
I have already deployed a service with ServiceWorker. Is this ServiceWorker not removed from the user's browser unless it is explicitly uninstalled on the program side?
Or will it automatically be removed over time from the browser of the user already running ServiceWorker?
Also, if I have to explicitly delete it, should I write the following code?
navigator.serviceWorker.getRegistrations().then(function(registrations) {
for(let registration of registrations) {
registration.unregister()
}
})
Browsers implement a call-home routine in which they automatically check for SW script updates when it's been 24 hours since the last time. In this check, the browser's HTTP cache is bypassed and the server will be consulted for a new version of the file. So in theory in a long enough time every client should automatically remove the SW.
However this auto-update was not in the initial SW implementations. If someone's using an old browser or some smaller browser without support for this then it might not be enough. For that reason, I would also use the unregister code you provided.
Use both.
This morning when I opened my heroku app in the browser, I noticed a banner advertisement was placed on the bottom. I added an instance (as to not be a free plan) and restarted my server, and it was still there.
I dug through their knowledgebase and stackoverflow, can't figure out how to remove these. Right now I am removing them with JS, but the goal is to not receive the extra load / advertisements.
Heroku will not inject adds into your site whether it's free or not. As mentioned in comments to your question, you should check whether it's something that's done by the network you're on. Maybe try accessing your site using https (i.e. https://paddlar.herokuapp.com/rivers) - with that, the network should not be able to modify responses.
The reason I don't want to go the browser plugin way is that you need to implement it for various browsers.
Like xpi for firefox, browser helper object for IE.
My target platform is only windows, and I just want the alternative of browser plugin to call a client side programe after instructed when the user is browser the web page.
Is that viable?
The only "viable" solution would be to register a protocol handler system-wide so say addresses starting with "myprotocol://" trigger your app. Users will still need to install your program and your program will only have access to the parameters passed by that protocol handler, so you will have to evaluate on your own if it's worth it.
Also note that some browsers or settings might show a confirmation message before using your new protocol for the first time, so users should be informed on what to do (and warned that this prompt is part of the normal workings of your app).
I am to build a web application which will accept different events from external sources and present them quickly to the user for further actions. I want to use Ruby on Rails for the web application. This project is a internal development project. I would prefer simple and easy to use solutions for rapid development over high reliable and complex systems.
What it should do
The user has the web application opened in his browser. Now an phone call comes is. The phone call is registered by a PBX monitoring daemon. In this case via the Asterisk Manager Interface. The daemon sends the available information (remote extension, local extension, call direction, channel status, start time, end time) somehow to the web application. Next the user receives a notified about the phone call event. The user now can work with this. For example by entering a summary or by matching the call to a customer profile.
The duration from the first event on the PBX (e.g. the creation of a new channel) to the popup notification in the browser should be short. Given a fast network I would like to be within two seconds. The single pieces of information about an event are created asynchronously. The local extension may be supplied separate from the remote extension. The user can enter a summary before the call has ended. The end time, new status etc. will show up on the interface as soon as one party has hung up.
The PBX monitor is just one data source. There will be more monitors like email or a request via a web form. The monitoring daemons will not necessarily run on the same host as the database or web server. I do not image the application will serve thousands of logged in users or concurrent requests soon. But from the design 200 users with maybe about the same number of events per minute should not be a scalability issue.
How should I do?
I am interested to know how you would design such an application. What technologies would you suggest? How do the daemons communicate their information? When and by whom is the data about an event stored into the main database? How does the user get notified? Should the browser receive a complete dataset on behalf of a daemon or just a short note that new data is available? Which JS library to use and how to create the necessary code on the server side?
On my research I came across a lot of possibilities: Message brokers, queue services, some rails background task solutions, HTTP Push services, XMPP and so on. Some products I am going to look into: ActiveMQ, Starling and Workling, Juggernaut and Bosh.
Maybe I am aiming too hight? If there is a simpler or easier way, like just using the XML or JSON interface of Rails, I would like to read this even more.
I hope the text is not too long :)
Thanks.
If you want to skip Java and Flash, perhaps it makes sense to use a technology in the Comet family to do the push from the server to the browser?
http://en.wikipedia.org/wiki/Comet_%28programming%29
For the sake of simplicity, for notifications from daemons to the Web browser, I'd leave Rails in the middle, create a RESTful interface to that Rails application, and have all of the daemons report to it. Then in your daemons you can do something as simple as use curl or libcurl to post the notifications. The Rails app would then be responsible for collecting the incoming notifications from the various sources and reporting them to the browser, either via JavaScript using a Comet solution or via some kind of fatter client implemented using Flash or Java.
You could approach this a number of ways but my only comment would be: Push, don't pull. For low latency it's not only quicker it's more efficient, as your server now doesn't have to handle n*clients once a second polling the db/queue. ActiveMQ is OK, but Starling will probably serve you better if you're not looking for insane levels of persistence.
You'll almost certainly end up using Flash on the client side (Juggernaut uses it last time I checked) or Java. This may be an issue for your clients (if they don't have Flash/Java installed) but for most people it's not an issue; still, a fallback mechanism onto a pull notification system might be prudent to implement.
Perhaps http://goldfishserver.com might be of some use to you. It provides a simple API to allow push notifications to your web pages. In short, when your data updates, send it (some payload data) to the Goldfish servers and your client browsers will be notified, with the same data.
Disclaimer: I am a developer working on goldfish.
The problem
There is an event - either external (or perhaps internally within your app).
Users should be notified.
One solution
I am myself facing this problem. I haven't solved it yet, but this is how I intend to do it. It may help you too:
(A) The app must learn about the event (via an exposed end point)
Expose an end point by which you app can be notified about external events.
When the end point is hit (and after authentication then users need to be notified).
(B) Notification
You can notify the user directly by changing the DOM on the current web page they are on.
You can notify users by using the Push API (but you need to make sure your browsers can target that).
All of these notification features should be able to be handled via Action Cable: (i) either by updating the DOM to notify you when a phone call comes in, or (ii) via a push notification that pops up in your browser.
Summary: use Action Cable.
(Also: why use an external service like Pusher, when you have ActionCable at your disposal? Some people say scalability, and infrastructure management. But I do not know enough to comment on these issues. )