I want to create a server for IoT (ODB GPS trackers for cars) that will send its status to server in real time and show it to client via a web applications.
The devices will connect to server using TCP, and then there will be client/web connecting to server via Websocket.
Spring Webflux is used for the client side. But I do not find a tutorial of Spring Boot TCP Server. And I read that netty is good for that (found an example using netty). So, because webflux is using netty underneath, can I use netty application code with spring boot?? Or is there a way using spring boot for tcp socket programming??
Related
I want to know how a web service written using java and spring framework able to receive and respond to HTTP request using web server. Is web server is one of the component of a web framework or it is independent of what framework we use. Can we deploy service written in node + express on a tomcat server ? If web server is a part of web framework then what is the flow. How spring instantiate a web server and how multiple clients request are responsed. Is it true that tomcat server can create a max limit of 200 threads only . What if we have more than 200 client request, why the response does not get delayed.
For handling http requests you will simply deploy the java/spring web application as war or convert into spring boot jar.
Tomcat can have more than 200 threads.
Can you deploy node+express on tomcat? the theoretical answer is possibly with some hack, but the practical answer is no.
Node is designed to run as a separate process. You can run your app using:
$node app.js
Can someone explain how hosting works ? in my spring boot app there'ss embedded tomcat server. as I understand the spring app runs with tomcat, tomcat takes some port, 8080 for example, and listens to requests coming to that port (when deployed locally at least) localhost:8080. I can make requests from my front end app, which runs on localhost:3000 and tomcat will take the requests, find controllers mapped to the urls that front request is directed to "/user" or "/myposts" or whatever, that controller runs code, talks to db inserts data into response and tomcat sends it back to front end.
If I deploy my app to some hosting service, like Google cloud, does the spring app still run with tomcat ? in that case which port will tomcat run on, where would my front end send requests to ? to the subdomain that google cloud has set up for my project ? Where would i need to configure SSL/https ? Would my front end send secure requests to google subdomain over https endpoints and it would relay those requests to deployed spring app through http(unsecured, inside hosting server) ? Or how ?
One of the most straightforward way to do this is to spin up an instance, ssh into the that instance and run your spring boot app the same way you would run it on your machine. Everything works the same as it would on that cloud instance. Your spring boot app still runs within tomcat and it still listens to port 8080. The only difference is now the hostname is no longer localhost and it will be the DNS name of that instance. You can find the DNS name on the console.
You need to get a SSL certificate if you wanna enable https "natively" in your spring boot app. Alternatively, you can set up a load balancer or an API gateway in front of your cloud instance to do the SSL termination for you. In this case, your frontend will send request to the load balancer or API gateway instead of your spring boot app. They accept https requests and transform them to http request and send it to your spring boot app.
I have a client-server application written in .Net. The client connects to a SignalR hub in the backend service using the SignalR client.
In the next few months I'm going to be migrating my backend service from .Net to Java and Spring boot.
I have to maintain backwards compatibility for my clients.
My question is, is it possible to connect from a SignalR client to a non-SignalR websockets server?
Sure it's possible. But it wouldn't be easy. You would need to implement the SignalR protocol on the server yourself. It is documented at https://github.com/aspnet/AspNetCore/tree/master/src/SignalR/docs/specs.
There are awesome tutorials for enabling JMS in spring boot and also there are tutorials to create Providers and Consumers of SOAP.
Can someone provide a step by step instruction on how to specify JMS as SOAP transport protocol and where does the JMS implementation live.
Is it: (SOAP + JMS) server vs client server, or client -> jms -> soap server?
Please explain how to create a working example.
I have a web socket server implementation using Netty (say listening on port 8081) and a separate Spring web application running in Tomcat (running in port 80).
I would like to somehow forward all request coming to localhost:80/Websocket to my Netty server on port 8081. Is this possible at all. since Tomcat and spring is build on top of http protocol, idk how this would be possible.
All I wanted to do is enable server push using websocket from my existing spring web app. Any suggestions?
The easiest way would probably be to put an nginx server up front and have it forward requests to /Websockets, however because Websockets is not Http 1.0 you can't use normal ProxyPass directives but according to http://www.letseehere.com/reverse-proxy-web-sockets it's possible via a special plugin
Take a look at the following 2 links which show how to have netty configured using spring. I have done it in grails wherin a netty socket server is running within tomcat, listening on a particular port for binary packets(not http)
link1
link2
Why not just use the WebSocket support in the latest Tomcat (7.0.27)?
Netty can handle HTTP. E.g. http://static.netty.io/3.5/xref/org/jboss/netty/example/http/snoop/package-summary.html