WebSocket vs HTTP - Indicate if the client is online or offline - node.js

I have an Angular web application which let users watch other users' profiles.
Those profiles should show if the user is online or offline.
I need some advice on how the "online users list" should be stored.
Should I use WebSockets communication to detect user connect and disconnect and base on that add/remove him from the list? Or either send HTTP request to the server when application is created on the user's browser (NgOnInit) on AppComponent and when user leaves (NgOnDestroy) on AppComponent?
Thanks.

Related

How to send post request to remote server (ip) via web browser?

I have bought remote VPS and i have telegram bot. I want to make email verification for this bot. So how should i send requests to scripts on the server when user clicks on the button "Verify" that contains some information about his telegram profile so i can approve him to use bot?
The main problem that i dont know how to send requests to scripts on the server by ip
There is no website on the server, maybe i should set it up?
Ive realized that i can do it like that. But any contributions would be met with enthusiasm)
Sounds like youn need an RESTful API to authenticate users.
And a client...

How to delete user connections to my app?

My app, which is unverified, has over 100 users. As per Google's policies, unverified apps with over 100 users will simply stop working. We are trying to verify the app, but cannot, since we cannot show functionality, because we have over 100 users. Does someone know how I can delete / remove all user connections from my app via the GMail API? Thanks!

Sending Push Notifications to Web Application without user consent

I want to send push notifications to my web application users on the occurrence of certain events by updating an icon with a red dot. This is similar to Facebook updating the "notification bell" icon with a dot, on receiving a message or getting a new friend request
LINK TO EXAMPLE IMAGE
I have tried to send notifications to the web app, but it requires the user to "allow notifications" before sending it.
Note that, Facebook/Twitter or any other social media sites can notify users even if the user explicitly blocks all the notifications for the website.
Socket.io is quite handy for this. You can just listen/emit some events at both client and server and act accordingly (in your case, updating the "notification bell" icon)

Communicating with the web server using Google Home

I have a social networking website developed in php which is hosted on the server. Here people can talk to each other through messages.
I want to send and receive the messages, to the other users through google home. It is not like a chat bot. But here, the first user will send message from google home to the website and then the second user will send the message from the website to the first user who will receive it through google home.
Can this be achieved? Do I have to develop some kind of mobile App, so that user has to send the message to the mobile app and then the app sends the data to the server.
or do i have to use the webhook which is available in api.ai?
Any help will be appreciated.
You do not need a mobile app - it sounds like most (but not all) of what you're trying to do would be handled using API.AI's webhook Fulfillment.
However, you're also trying to do asynchronous operations (send a message or a notification to Home without the user prompting for it). This currently isn't possible - you can currently only send a message in response to the user taking some action.
One possible workaround for you is to allow the user to ask "how many messages are waiting for me" or something similar at any point. You can also play multiple messages in reply to a message they might send. However, you have limits (about 5 seconds) on how long you can wait to send a reply to a user instruction.
You can implement a chat bot e.g. via Dialogflow (former api.ai), however you can just react on inputs. You cannot push a message on Google Home (yet). So you could the bot read your mailbox but not implement a chat.

How can I use SMTP and Gmail in an end user application?

I am working on an application that requires communication via email with the user and the client for whom the application is being developed.
Basically the flow is thus :
Program Does Something
Program sends an email detailing if it worked or not to the user and my client
We have established a Gmail account to make this happen. Unfortunately my clients users are multinational and Gmail freaked out and started blocking users, which started throwing exceptions when they were trying to use the program.
In the emails I saw when I checked the account, I saw I see at least two of these emails that say "Suspicious sign in prevented", and there was a red bar that said multiple attempts were tried to sign in and asked if it was me, and there were points all over the world.
How would I go about making it so that Gmail doesn't freak out when it sees users trying to sign in all over the planet?
Isn't sending through a some kind of a server application not an option? I.e. instead of making SMTP connection from your end user app directly to Gmail server your app sends a request to your web server which does actual SMTP connection. This way you'll also eliminate issues when SMTP ports are blocked on end users' machines.

Resources