Handling whether or not the user has already seen a popup, ReactJS - reactjs

I am a bit dumbfounded on how to achieve this properly. So you have an app that is getting regularly updated, and you show those new updates to the user (something like discord update popup and whats new and such). How do you handle whether or not the user has seen it? A more high level question that "local storage", I am well aware of that or storing it in a DB, but this doesn't seem 1) Scalable, 2) Easy to work with in the long run. Are there any JS libraries that can simplify the process, eg or do I have to manually track each update? If there are more updates or the user hasn't logged in a while
I hope I conveyed what I am working on properly. Would love to hear how it's usually done.

Q: have an app that is getting regularly updated, and you show those new updates to the user
A: Service Worker can help you .That support reacting to push message .And they provide the Push API gives web applications the ability to receive messages pushed to them from a server, whether or not the web app is in the foreground, or even currently loaded, on a user agent.
More detail about start up a service worker to send users a message . https://developer.mozilla.org/en-US/docs/Web/API/Push_API .
Finally I suggest you try Workbox , that is a library that bakes in a set of best practices when working with service workers.

Related

How to get notified when a logic app is created

I currently work with a small development team and I would like an email notification to be sent to me upon creation of a new logic app which would then allow me to configure new alerts for each new one to say if logic has experience a failure of some sort. Right now I constantly have to check the logic apps in the portal to see if any new ones have been created as of late. I couldnt find any info on this. Any help would be greatly appreciated.
This can be done by creating an alert on activity logs, you can look at the newly created logic app in your activity log and create an alert. You can also use these alerts to trigger emails https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/activity-log
https://learn.microsoft.com/en-us/azure/azure-monitor/alerts/alerts-create-new-alert-rule

How to dispose existing services instances and inject new service instances in AngularJS?

I'm working on an AngularJS 1.6 web application.
There are a number of AngularJS services in the web application. I'm beginning to implement features that use the services to persist state between views.
However, this is becoming problematic when the user logs off and another user logs on. When the new user logs on, the services persist state from the previously user. I know that I can theoretically write code to put the application in a specific state when a user logs in, but it seems to me like it would be easier to simply dispose the stateful services and instantiate new ones when a new user logs on.
Is there an expedient way to do this?
The expedient way to do this would be when a user logs out, do a hard refresh and send them to the login page. This should wipe data that is stored in memory across the whole application.
If you dont want to perform a hard refresh, you're just going to have to clear out the data manually for each service, which depending on the amount, could be a fair bit of work and most definitely not expedient.

Send updates to a user using Socket.io and nodejs

I'm building an app using MEAN Stack (something like Facebook). So a user can login to my app using different browsers and I want for example, if there user will add a new message to the MongoDB, I want to update his messages in the other sessions. The same of he will remove a massage. At the same time, there maybe logged in different users from different browsers and I want to notify the user with his update in the other sessions.
Does Socket.io supports such an option? And what is the best way to do it?
Thanks.
Yes socket.io do support that. Here is an example made by socket.io themselves: https://github.com/socketio/socket.io/tree/master/examples/chat
You should be looking for socket.on() which are the listeners for an event on the server side and look into socket.emit() which are the senders of the events. the .emit()could be added into an function which are triggered on a button click for example.
Depending on you needs, if you're going to send the message to every user using your app then you could use this above code. But if you only wants to send to a specific list of persons you should look into something called Rooms (http://socket.io/docs/rooms-and-namespaces/#rooms).
This does exactly what it sounds like, it emits the messages to the specific room where users have been added to when they connect to your application.

Counting time when user is logged in

I am trying to develop a solution to following problem. I need to store in db information about time when user logged in and is on page. Currently I am writing to db when user login and logout with WCF service, but how to deal with situation when user closes window or goes to other webpage.
I am wondering if threaded function which calls every user every minute to check if he's alive is a good solution. Any help will be nice. Thanks.
If You can wait for data a bit(depending on Your aplication usage), You could save data to IsolatedStorage, and send it when user starts application again. It's pretty simple solution, but You will have to wait for data and some data will be lost, if user don't open application again(Again, depends on Your app).
Other solution would be sending data from JavaScript (How to call WCF from JS) during OnUnload or OnBeforeUnload event. Or even doing a simple HttpRequest from JS to some aspx site, passing time in query.
EDIT: Another thread is a nice idea(I have solution like this in my current project) but running it too often can clog IIS (depend on number of users, bandwidth etc). It also will prevent Session from timing out, even if user does nothing (that's main purpose for using this solution in my project).

In Silverlight programming, how to prevent visitors from caching the downloaded content?

I want to create an online quiz website using Silverlight.
When the registered users are logged in, they can view and answer the quiz once per page.
To proceed to the next question, they must push next button, and the new data downloaded from the server.
The previous questions are not cached. Thereby everytime the question is requested, the question will be reloaded from the server again.
My question is how to do my scenario above in silverlight?
Thank you in advance.
Now that your intent is clear, you want to prevent discovery of the content in your assembly. The answer is you can't really protect your assembly. In order to run it the client needs to fetch it, if it can be fetched then the would be hacker can get it, trying to limit caching isn't really a prevention.
However the solution is to not put senstive stuff in your assembly to start with. Place code server side to do the sensitive stuff and access that code via a service interface such as WCF or Web services or even plain old XML in XML out posting.
You could use IsolatedStorage to store some state related info (and you can even encrypt it before you save if you want - it's your storage, do what you want with it). Another way to store state information is to use cookies, here and here.
The "state" information that i refer to is the state and/or progress of your Silverlight app, i.e. you can track where the user got to in the questions, and avoid requesting questions they have already completed. Both of these types of storage can be deleted by the end user, if they know what they are doing. But you shouldn't let that worry you - if they want to cheat, then let them.
Create the silverlight app to request the questions via a Web Service. As long as you're using a proper web service and not faking it in some way. The browser is not going to cache the webservice response.

Resources