Implementing websockets with angular, node and mysql - mysql

I have a Angular app that serves content from a Node.js API which gets the data from a MySQL database. The node API server just gets the data from the database, it doesn't insert anything. A Spring Boot API microservice inserts data into the database.
How would I implement WebSockets so every time the Spring Boot API inserts something into the database, the content is served into the Angular app in real time.
I have a hard time finding tutorials on this topic, help would be greatly appreciated!

Your app will work in following model. i.e :
when page refreshed or loaded, base content will be retrieved from node API
web socket and watcher will based on Angular (client side) + spring boot (server side). web socket implementation doesn't rely on node API.
You need to create client sender and receiver with Angular
Spring boot receiver and sender for mysql, Also to inform client.
When there is new text entered, client and server will communicate via web socket. You don't need to return any data in spring boot but spring boot web socket should inform the client about the new connection/text etc.
Please check below link. Which demonstrates socket implementation of Angular + Spring boot.
Link :
Spring Boot Angular Websocket
Angular 6 WebSocket example with Spring Boot WebSocket Server | SockJS + STOMP

Related

Concept Confused : Cloud Interaction with Wordpress in GCP and APP with Spring

I'm quite new to wordpress and GCP, learning programming less than one year.
Now I'm writing a project using wordpress in GCP and mobile app in the frontend and MySQL in GCP and Spring Boot as server and controller.
In GCP, Wordpress, MySQL, Apache, etc are included and managed.
As you can see in the architecture I assume they will work, there is no need to send Rest API to spring boot and react to DB. I would like to know if I am right about the basic concept.
There is shared information in wordpress and app, for example, membership data.
In app, we send request to spring and spring reacts with DB in GCP, as wordpress acquires data from DB again, a new member info is loaded automatically in the frontend.
And in wordpress, request is sent to DB in GCP and Data is renewed. Once the app acquires data thru spring and DB, the new in is loaded.
I have the issue because the mentor said it is not usual practice for web to react directly with DB, and the co-workers insist establishing a connection between web and spring. Why?
The initial concept is to create a web and app that shares same database, but create different functionality, web for selling, app for interactive activities. We learned the basics in java, spring and web, but we are really unfamiliar with network concept.
(The frontend part and DB establishment are finished. We are working on the Server part.)
If there is any clarification or any suggestion to modify the whole procedure, it's well appreciated.
If there is any nothing I did not explain so well, I will try harder.

What App server to use for json and soap API

I am trying to select a app server platform to service JOSN & Soap POST requests from client app on Desktops. The app server runs on linux and use PHP code.
I searched and found PHP framework but that doesn't give you easy to use auth user/password, so you have to do the auth in app code. What is to use for simple request/response app server with secure auth like user/password on first request and then token like normal web servers.
Currently using Drupal 7 REST services module to handle request auth, but SOAP has security issues. Looking for better and light weight framework.
For your API : https://www.drupal.org/project/jsonapi (it's gonna be implemented in 8.7 anymay)
If you have an external authentication provider (like keycloak, azureAD…) : https://www.drupal.org/project/oauth2_jwt_sso
If you don't : https://www.drupal.org/project/simple_oauth

Working with azure(mysql database) in node javascript with cloud API

I'm working with an API app on Azure by deploying an API written in NodeJs which stores data in MongoDb.
Make a new API for web & mobile apps from Azure portal.
Choose MongoDb by adding MongoLab module from Azure.
Create a table (collection) and populate it with few entries.
Prepare our Git repository from Azure portal and link it to our local Git on computers.
Decide which NodeJs modules to use to set the dependencies.
Edit the configuration file for NodeJs.
Make the main API file with the following functionalities:
Connection to the database.
Running the service.Making CRUD operation services (CREATE, READ,DELETE...)
Testing our API on a browser.
Making an application using our API
My question: how to use these steps to store data in mysql database(azure)?
I cannot fully understand your requirement, do you want to use the MySQL database to store your data in your API application in Node.js? If not, please clarify your purpose.
To implement connection to MySQL in Node.js, you can use some 3rd part MySQL handler modules.
For example:
node-mysql - A pure node.js JavaScript Client implementing the MySql protocol
or
Sequelize - A promise-based ORM for Node.js and io.js
Any further concern, please feel free to let me know.

JavaFX + Spring + JDBC is possible?

my school projekt task is to develop Issue tracking System. My imagine:
JavaFX desktop client application + Spring 4 server + MYSQL database
I would like to use JDBC to reach datas. How should I do it? Spring server made the queries and after it, the spring server should send the client the serialized data?
Yes it's possible, though you don't need spring in that scenario.
Jdbc client would connect directly to the database over the network.
You would have to expose your database to public tcp connections, and firewalls would have to allow this too.
Other options:
Use a local database, like sqlite , and sync w central db over https using a tool like symmetricds. This gives you offline capabilty.
create a restful api on the server, and have the client get and set data using http.

Connect web server with database and J2ME

I do a mobile application which the user can use it get the required place’s number. The user must select the appropriate city and category to get the place’s information. All the information stored in the database.
What I want to know that ..
1) What is the benefit from the web service?
2) How to connect the web service and MySQl database?
3) How to connect the web service and mobile application to get the information from the database?
1) Benefits. You didn't mentioned other options, but if you are talking about some custom server-side implementation, the benefits are numerous:
It's easy to connect to web service from J2ME.
Multiple connection sessions at one time.
You can use web service from different applications and different technologies.
No issues with authentication and authorization.
You just call method from ws and in response you get easy-to-parse XML.
2) Web service - MySQL:
You have to create a Tomcat or IIS web service.
From web service code connect to MySQL, call a query and return the result.
For Tomcat and Java web service:
Getting started with Web Services Using Apache Axis
Developing and Deploying Java Web Services with MySQL on Apache Tomcat and Axis on Windows
JDBC for MySQL
For IIS and C#/.NET web service:
CodeProject:Your first C# Web Service by Chris Maunder
How to connect to MySQL 5.0. via C# .NET and the MySQL Connector/Net
3) J2ME - web service (with JAX-RPC)
1. generate stub from web service WDDL using J2ME Wireless Toolkit
2. add stub to your project, import stub namespace, set connection properties and call stub methods
How to build and run a J2ME Web service application?
Web Services APIs for J2ME, Part 1: Remote service invocation API