For learning purposes I’m creating an Android app that does the following:
When a person arrives at school, he/she can check a button in the app and he/she is added in real-time to a list (in the server database) of everyone that also checked “at school” button within the app. He/she can also add a message before clicking the button.
The rest of the students then receive a toast in real-time with the person’s name that arrived and it’s message.
I know how to do the Android part, but what is the best way to do the real-time event queries and requests in communication with the server? For example, I send a socket with the persons confirmation, location and message to the server. From the server-side, I supose there’s a nodejs controller that receives the socket and updates the database in sql. Then it sends a socket to every client online and a confirmation to the checked client.
Is this the “professional” way to handle data like this? What is the best (fastest, more secure, standard) way? When I Google how to make this communication I can only find web server client-server communication with Apache, but I’m really looking for a real-time event with an Android app.
I’m not really looking for code but to know and understand technologies and design patterns on how this can be done. And what to search for in order to learn how to do this.
Related
I have a machine learning model that has been trained using patient data. Now I want to deploy this model via a web application, so that doctors can use it!
I know I can use Flask and Django for this but there is a problem that the patient data should not be sent anywhere because of data privacy.
The patient data entered in the application should only remain on the end user's device as all data processing should be done locally in the application or web browser environment.
I know it is possible to do this with native app. But I want to avoid a native app as much as possible. I would like to have the model as a web page.
Please does anyone have an idea of how I can deploy a Machine Learning Model, so that the data entered by the user for the model to make the prediction also happens on the user's browser? I.e. no server, no anything like that. Everything (Input of new data, Predictions ) has to happen on the end user's device
Thanks in advance
Hi so first I apologize if my query may seem unclear, it’s first trying to do what I’m doing and I haven’t full idea around the intricacies and lingo lol.
So basically I’m running a NodeJs web server with React handling my front end. I’ve got Express to help manipulate user sessions and I just came by Server-Sent-Events as a way to send one-way messages(which is what I need to do). So far I’m able to send updates and messages via cURL on the terminal and running JS scripts, however these updates/messages go to every active client session but I want/need to be able to send these messages to specific active client sessions/connections.
Example: 5 client connections are established (session IDs A,B,C,D,E), now I want to send an alert message to session E only and manually.
I’m still green with NodeJs/Express and the concept of SSEs however I’m learning as I go for this pet project.
Send help
What you want is how SSE works. It is a dedicated connection between a client and a server process.
however these updates/messages go to every active client session
If that is what you see then your node script is running the exact same code for each client.
I think your question might be higher up - how to organize the data messaging? That is too big a topic for a single StackOverflow question, because it will depend on so many factors specific to your use case.
But one way would be to have an SQL database, with one record for each user. The node script polls that database table and if the record for the current user changes, it sends the new data to them. Then to send data to user E, you just edit the database record for user E.
I’m building an app with some location-based requirements. One of the requirements is to send the user a notification whenever the user is at a specific address (think of it like how the Apple Wallet app sends you a notification whenever you get close to, say a Starbucks location).
How would I go about building this kind of functionality? I’m aware that this will require using WebSockets. But, like, how would I do this exactly?
Do I just have the client send his geo coordinates to my backend every time it changes, then compare that to a desired destination saved on a database? Or, is there a better way?
Thanks.
I want to add a send message and inbox option in my node.js application. Basically the website is all about posting jobs in the forum, where three types of people can search and post jobs according to their profiles. Three of them are freelancers, mentors and clients.
So in order to them to communicate with each other, is there any way i can include a chat option in each of their profiles, so that they can send messages to each other.
I have also checked the option of Socket io for chat application, but i am little confused that whether is it a right solution according to my requirement or not.
socket.io will allow for realtime chat communication like gmail's 'gchat',
so socket.io would be a relevant solution to your problem.
Server: NGINX/PHP running Laravel 5
Let's assume I have two users on different computers with sessions to the application.
User 1: makes an ajax call that is handled by one of the server controllers.
User 2: needs to get notified of this as soon as user 1 made this call to the controller.
Now, user 2 can have a javascript polling mechanism which asks the question "has this happened?" repeatedly, but ideally I'd like to avoid the constant calling and have him/her notified upon occurance instead.
Is there any way to have like an "open socket" for user 2 to be notified when certain events occur in the controller?
Ideally I'd like to avoid installing a third party messaging system, XMPP Etc on my server. Is there any best practice where this functionality can be achieved?
Sockets.io is indeed a good solution for this. I'll be using it on both the server side (Separate NodeJS server for this), and the client javascript side.