How are real-time notification systems made in Nodejs? - node.js

I want to create a social-media website project for my peronsal portfolio. But, I am really confused about how to develop a notification system.
If user-A likes a post of user-B, user-B should be instantly notified. Once he opens it, the notification will be read. Sometimes, even multiple users need to get the same notification. How is this achieved? Not talking about some 3rd-party tool but how the architecture works and if there iss any way to efficiently implement this is Node.js.
I do not want user-B to keep hitting any API for checking. I want the data to come instantly as it does in Facebook, or even in Stack Overflow. Any solution?
I am using MEAN stack.

Related

Embed and manage Google Forms in NodeJS app

I have the following use case.
Status quo:
We have a NodeJS app running that is not publicly accessible. We'd like to introduce some kind of form to acquire some data of the users/participants and that is used for another follow-up process upon completion of the form.
As we'd like to have a quick but also nice solution, I thought about embedding a Google Form as an iFrame in the app that we have already prepared some time beforehand. The Google form also gives us some additional features regarding the form creation that I don't know would be available in any Node native libraries or would be time-consuming to build, I assume. Moreover, we are partly working in the Google world so there might be some easy and fluid workflows possible.
Goal:
Now, my goal or rather problem with using the above-mentioned method is that I don't receive any notification, leave alone the responses, upon completion of the form.
I know the responses can be saved in a Sheet in Google Drive that could be requested by the app but I still don't know when someone has filled out the form in the app so that the follow-up process in the app can immediately be triggered.
Is there any way to solve this problem? I maybe thought about a Pub/Sub topic that was pushed to the app but then, again, the app is not publicly accessible.

How should I build this app over communcation apps?

These days I am finding myself in the position of having to implement for one of my college courses a system that should act as a giant wrapper over many communications apps like Gmail , Facebook Messenger maybe even WhatsApp .To put it simply you should have a giant web interface where you can authorize Gmail , Messenger and use them at once when required. I am thinking of going with an REST API to manage the user's services authorized by OAuth2.Also I am thinking of using Node.JS and Express.js in the backend and React.js in the frontend. I found some sweet libraries in npm that should take care of interacting with the involved APIs(https://www.npmjs.com/package/node-gmail-api this one for instance), but I am also doubtful about this approach , for example I have no idea how to keep the use notified about its incoming mails or messages for example . I am in dire need of some expertise since I forgot to mention but I am quite the newbie in this field. To sum it up for once my question is how would you implement such an infrastructure ? Is it my approach viable or I am bound to hit some really hard to overcome obstacles?
As a college exercise, it would be a really fun experiment, so it definitely worth the time you want to put into it. However, once you want to add more features, the complexity will go up pretty fast.
Here are a couple of ideas you can think of:
It's pretty clear that your system can't do more things than the capabilities exposed by the APIs of communication apps (e.g. you can't have notifications in gmail if the API doesn't have this capability).
For that reason, you should carefully study the APIs and what functionalities they expose. They have public docs that you can check out: (Gmail API, Facebook Messanger API)
Some of the apps you want to communicate with may not have an official API (e.g. WhatsApp) - those kinds of details you definitely want to know from the start.
Based on the analysis of those APIs, you should lay out a list of requirements for your system, which can be extracted from all the APIs, for example: message notifications, file transfers, user profiles, etc.
In this way, you know exactly what capabilities your system should have, and you don't end up implementing a feature that is available only in 1 API out of 4.
Also, it would be a bit challenging to design your system from a user perspective, because the apps have different usage patterns - chat apps, where messages are coming in real-time, vs email, which is not real-time communication. That's just a detail anyway, the gist of your project is to play with those APIs.
Also, it may worth checking out the Gateway Aggergation Pattern, which is related to this project - you may want the user to send a message to multiple apps, by using a single request to your service.

NooB Alert NodeJs and Slack Bot build. Need Advice

Prewarning: I am a noob with development, I started doing web design when I retired from the Marines about 3 years ago. I specialized in Intelligence and Tactics, so not a computer user during that career. Fast forward to Today:
I work as an Exchange admin and migration specialist with GoDaddy, I have been through several Webdesign courses and learned a decent foundation of html/css/php however JavaScript, Nodejs, Java, Python, C++, and C# are all still things I am working on.
My issue: My lead wants to have a bot built that essentially posts messages in the #general group (I learned how to do this and actually setup a nodejs server within my test hosting server # GD and have a Joke bot running in my slack WS). The tricky part that I have been scratching my brain on is how to use an web API that GD has to monitor our call que, hold times, and agents online. I need to figure out how to get the bot to post a message regarding certain triggers automatically(exp. Hold time exceeds 10mins). I can not figure out whether to use a webhook, eventListener, or a direct bot auth'd into the GD api like my joke bot that links to chuckNorris jokes.
I appreciate all the comments truly, I have thick skin and know that I am late to the game on development. I want to build this for the experience and to integrate with slack, my end goal would be more projects to eventually become a Dev within GD.
I have a few thoughts that might help you.
Regarding these holdtimes, agents online, and call queues, think of these as events. Whenever these events occur, they should fire a payload (HTTP request) to your service that then posts messages to slack. I think you might need a slack bot token for this.
Many APIs have this functionality under webhooks. You provide them the URL to the endpoint your developing and theres usually a toggle to tell them that you want to start accepting events.
To get going on your service/bot, I'd recommend starting with learning about what these webhook event payloads will look like in terms of structure so that you can parse it.
If you have more detailed questions feel free to comment or message. Happy to help. I've written a slack bot or two.

Hybrid App Development, Database-Driven Content

I've been doing a lot of research, and perhaps just need a few dots connected.
I have an idea for a mobile app/website that contains lists of local eating/drinking establishments along with the deals/specials they offer each day. The idea is to create an app that people can refer to in order to save money on a night out.
I'm familiar enough with HTML/CSS/JS to create a functioning website, but when it comes to backend I'm a little confused. Editing the markup in order to reflect changes (e.g. a new deal starts or new establishment opens up) is a bit cumbersome. Now I know I want a database with my information ready to be displayed on my page. Does this mean that I need to develop my own API for everything, and then make sure it integrates with the hosting website that I end up choosing?
I feel like I'm missing something that should make it obvious what the next step is. Can anyone offer any advice?
The short answer is yes, you are exactly right.
The long answer is that is definetly one way to do it. But, for large projext just using JS can get quite cumbersomoe on your client end. Usually the first level would be using something like ajax. It's a great way to start and you can go a long way with just ajax. This is acutually where most people "start" when using just javascript to make api calls. The next level would be to use a framework like Angular. This will of course do more for you than just help handle api calls and it requires a larger investment in learning.
So that is all client side...
Now for the server side part... When you publish a website you are now dealing with "server-side" content. You have taken your static content and it is served up from the server but it's always the same static content from the server then it becomes dynamic on the client when all the javascript starts getting parsed.
The API is another server side component. But instead of being static like your pages, a bunch of files just sitting there, it is an actual application on the server. It takes a command via an api request and then does its thinking and then spits out a response object dynamically to the requester, which in this case will be the JS on your site.
Now, if you don't like the idea of learning to make your own API there are resources out there that will host an api for you and give you a gui to build your own API. I can't recommend one because I have never used one, but I do work with businesses that do and they love the fact they don't have to hire a dev to make thier apis. The downside is they are tied to that service and limited to the functionality that the service offers. It's not a big limitation as the services are quire powerful but if you are going to be managing complex data sets then it would probably be better to learn to make your own api.
Hope that clears things up a bit for you!

How to make chat app with maintain the chat history in Mobile php+nodeJS+socketIO+AppGyver

I'm thinking to do Chat application in AppGyver. For now I have chat app on web with NodeJS and SocketIO, messages are store in MySQL. I was thinking how to keep on phone messages history like whatsapp.
The first thing that came to mind is that i store messages in SQLite on phone. But now bothering me the following problem, how to refresh the changes that were made while the user was not online? Perhaps to make a new table in MySQL which would contain changes made while the user is offline.
For keeping the changes involves information about the deleted conversations, deleted or added messages.
The second thing that came to mind is that all the data which get from the server, to keep as json files. However, it is difficult to carry out the changes that have made while the user was not online. At every refreshment need to open all files, then find the appropriate value and make the change.
Which of these methods would you choose, or you may have a better solution?
I wonder if someone has done something similar and whether there might be a better solutions than mine?
Best regards.

Resources