consumer producer communication from java to javascript - javascript

I have a very common problem and believe me I am not able to find a apt solution over the internet .
[problem]: Front end application
Here in this current architecture I have tried using
SNS
But not able to figure out do I send data to a particular logged in user from Application A
SQS
Same issue on how do I send data to a particular logged in user
push notification
That works for every user but still it requires permission from browser and a lot of other stuff
I have also come up my own solution which became very complicated but
this is a very common problem and there is always a very good design
for this I am sure but not able to figure out what it is?
The java application is spring boot
The middle one is Nodejs
The front end is JavaScript
Can some one give me some idea on how do I achieve this ,or if someone can guide me into a correct direction is much appreciated .
Thank you.

Related

Using DialogFlow to login in my application

Well i've searched here and in the documentation of dialogflow and coulnd't find any help in this subject.
I have an aplication and I want to use dialog flow to login in my website, there is a db where my login infos are stored.
So i'm only looking to say to the bot that I want to log in, it will ask my credentials and compare with the ones in my db.
Is there any docs about it? Where could i find something to help me in this?
Perhaps i din't explain well what i want or maybe did something wrong...
Reading through the doc i noticed that i can add js events to the chat...
const dfMessenger = document.querySelector('df-messenger');
dfMessenger.addEventListener('event-type', function (event) {
// Handle event
...
});
Something like this, i grabbed this code from here https://cloud.google.com/dialogflow/es/docs/integrations/dialogflow-messenger#js-events
Can i use this to create a function were i grab the users info and authenticate in my database to login in the application?
This is fairly advanced stuff and I would start with a more basic chatbot before attempting any of this.
I liked Lilis is a first hands in project into dialogflow ES but you could find your own. https://medium.datadriveninvestor.com/build-dialogflow-chatbot-lilis-1-what-are-the-top-seven-minimum-viable-product-features-of-a-998d6bfb60e7
It goes through how to structure a chatbot before how to design it which can be a vital step, limiting the abilities before coding starts.
DialogFlow allows you to make a basic/advanced CA.
User asks a question, CA either replies automatically or fetches a reply.
Dialogflow has a language behind it if you're fetching a reply, Python, Node, Java, C...
All of those languages can connect to a database and check the database parameters on the background once a chatbot gets the propper input then the chatbot can reply based on wether there was a match and the code has done the appropiate changes to the URL, for example.
If you're using the default webhook it needs to be done in node.
Dialogflow can do just about anything that can be done reasonably quick on the background as it supports most of the top coding languages for the replies on the background

Application web: message sending

I am developing a web application where several clients can send messages to each other, it would be like instant messaging without strong real-time constraint.
To illustrate the situation, let's imagine a classroom where students are on a web page and can send messages to their teacher who is on another web page displaying all the messages.
The teacher can answer questions and therefore the pages of the students who have received answers must update with the respective answer.
The first research of solution are unsuccessful because it turns around form and installation of specific library.
What is the easiest solution to implement?
For information, I am developing with javascript, php and mysql; I have no possibility to modify the server part nor to install libraries.
Thank you.
LG

Get steamID with Steam API using javascript

First off sorry if this question is a 'bad' one; I am very new to the world of web apps, API's and Javascript.
As the title says I am trying to get a user's steamID using the Steam API using javascript.
This is for a web app that needs to get information about the games a user plays. (Which from my understanding is only obtainable using this special ID.)
My initial thoughts on how to do this would be to use openID so that the user gives Steam their info and the ID is returned to my app.
I have seen that there are lots of examples of this using php; however, because of project requirements, everything must be run in the browser. There is no backend server to even run php on so it is not an option what so ever.
I have spent a better part of a day trying to figure this out and have made no real progress, everything seems to lead back to using php. (maybe what I need under my requirements is not possible?) So an example or anything really would be much appreciated.
welcome to Stack Overflow I can see you are confused as to where to start or progress so here is a basic roadmap:
You will need to contact Steam to get an API key first.
Next part is more tricky for a beginner. You will need to get node.js which is a package manager. Effectively it's a large library of javascript programs which you can import into your own program to do things with. One of these so called "packages" is openid-client, which is an implementation of openID that you can add to your site. Users click on the openID button on your site, it redirects them to steam servers, they login, then your site gets their info without leaking their username or password to you.
Now that you have both the steamID and your API Key your program can input these two into the url steam provides to get owned games. You can input this completed url into fetch or axios (another node package that can request data from servers) and it will respond with the user's owned games in json format.
Here are a list of resources in order to get you started:
https://steamcommunity.com/dev
https://nodejs.org/en/
https://www.npmjs.com/package/openid-client
https://www.npmjs.com/package/node-fetch OR https://www.npmjs.com/package/axios
https://developer.valvesoftware.com/wiki/Steam_Web_API#GetOwnedGames_.28v0001.29
I suggest reading the documentation in each of these links and seeing if there is any youtube tutorials that try and do what you are doing with these technologies to help you implement them as a newbie. Overall there is a lot to learn on each of these technologies but as long as you orient yourself using guides or tutorials you will succeed. Good luck.
Check out this page: How to retrieve Steam username using SteamWorks API?.
However, it seems like an issue you might be having is connecting to the actual API. What exactly are you using for testing?
I know from experience, for example, that you can connect using Postman to various API's, and format a request for them in a chosen language, including JS>

How to create a login system that stores user data for beginners?

I'm working on my first web app using ReactJs and have the frontend pretty much done. Now I want to be able to pair the user's data with their username so next time they log in, everything will be exactly as they left it. The user's data is currently all in a JavaScript object so I think I want to save it as a json file. However, I have no clue how to even start this.
My first issue comes with creating the login system. Obviously I cannot just store the username and password in plain text so I would need to encrypt and decrypt it somehow. However, I am currently hosting my site on Netlify so I would need to pass that information over there somehow and the only way I can think of is by adding it to my GitHub repo which is public so anyone can then see my encryption algorithm.
I'm not even sure if this is even how you do it since I've never done anything like this before. Does anyone know where I should start? I don't need something super sophisticated just reasonable.
Probably you can use google's firebase and firestore services. They have an amazing documentation on their website too and there's plenty of resources online. google for firebase authentication tutorial and you'll find a whole lot.

How can Users manage and keep their in-app purchases with my app?

please I need some help. I developed a mobile app for a client. Within the app, users can purchase video courses that they can watch. But my challenge now is that when a user buys a course, if he refreshes the app and comes back to the course, he's taken back to the payment page of that same course he already paid for, instead of being taken to the course. I have been trying to figure out a way to solve this, I don't know if anyone can help me. The app is built on HTML5. I don't know if anyone has a Learning Management System Code or something like that, that's based on HTML that can resolve this. Or better still, I appreciate if you can help me figure this out in anyway. Thanks
A solid way to achieve this is to store the values in a database with a unique ID, and perform an AJAX call when you load the app to see who has payed for which parts of the app. You can create a simple API to write all approved transactions to, and perform a GET request on that API to check if the current user has any purchased items.
If you use something like cookies, or even local storage, the data can be wiped relatively easily, and it will be hard or even impossible to track who has and hasn't payed for what.

Categories

Resources