how to interact between TCP/IP server and web app in J2EE - system-integration

I have a Web application based on Spring MVC 3.2 and TCP/IP Server written by Netty. Recently, I have got some requirement. It needs to be sent to the TCP/IP client via the TCP/IP server when a user wants to type some message on the Web browser. Of course, the message should be go to the Web application first and it will pass it to TCP/IP server and get back result. What would be the solution covering this requirement? I am having a look at AtiveMQ and Camel but not clear how to build these kind system.
Please let me get some clue or example.
Thanks.

Related

Oryx CycloneTCP WebSocket Support for HTTP Server

I've started to evaluate Oryx Embedded CycloneTCP library, and able to run HTTP server / DHCP client with CubeMX config tools and STM32CubeIDE for custom STM32H7 board.
However, I did not get how to configure WebSocket support for HTTP Server. So I need some help / sample / demo code for it.
Its an a bit older question, but nonetheless...
https://gricad-gitlab.univ-grenoble-alpes.fr/Projets-INFO4/20-21/05/STM32F7_CycloneServer
shows how to implement a simple websocket->CAN Bus gateway.
Take a look at CycloneServer/Core/Src/main.c
In httpServerRequestCallback() the http connection gets upgraded to a websocket connection.
Received frames are processed in a seperate task (clientTask()).
sendCANBusToClient() shows how to send messages to connected websockets.

ActiveMQ - Stomp over websockets - Same Origin Policy

I have a process that runs in California that wants to talk to a process in New York, using Stomp over Websockets.
Also note that my process is not a web app, but I implemented a stomp over websocket client in C++, in order to connect things up to my backend. Maybe this was or wasn't a good idea. So, I want my client to talk to the server and subscribe, where their client pushed messages.
I was implementing my own server when I saw that ApacheMQ supported Stomp over Websockets. So, I started reading the docs.
It says with the last line under 'configuration' at
http://activemq.apache.org/websockets :
One thing worth noting is that web sockets (just as Ajax) implements ? > the same origin policy, so you can access only brokers running on the > same host as the web application running the client.
it says it again in several related searches such as http://sensatic.net/activemq/activemq-54-stomp-over-web-sockets.html
Is this a limitation of the server or the web client?
With that limitation, if I understand right, the server is not going to accept websocket connections from a client, of any kind, that is not on the same machine?
I am not sure I see the point of that...
If that is indeed its meaning, then how do I get around it in order to implement my scenario?
I've not found that bit of documentation you are referring to but from what I know of the STOMP implementation on the broker this seems incorrect. There shouldn't be any limit to the transport connector accepting connect requests from an outside host by default and I don't think the browser treats the websocket requests the same as it does other things like an Ajax case in terms of the same origin policy.
This probably a case that is best checked by actually trying it to see if it works, I've connected just fine from outside the same host using AMQP over websockets on ActiveMQ so I'd guess the STOMP stack should also work fine.

How can I connect to sockJS from a client written in Go?

I have a server that uses websockets. It is written in Go. For testing, I have another application written in Go. To test, I start the server, then run the test client. The test client creates websocket connections to the server and does things (basically impersonating user activity). Both the client and the server are using the gorilla/websockets library, and standard browsers also work fine with the server.
This was all working beautifully.
To support non-compliant browsers, I was asked to start using the SockJS Go server library. I did this and the new version works just fine when used from a browser by clients using the SockJS library.
Now for the problem. SockJS does not accept incoming websocket connections. Only connections from the SockJS client. So my testing application doesn't work, and I'm unable to test.
I could recover the old version of my connection code from git and make a separate connection type that uses gorilla/websockets and have my server listen on an additional port that only listens on localhost. This would allow me to test the functionality. The downside is that I have to maintain two versions of essentially the same code, and I wouldn't be testing the real user experience and possibly not find bugs until production.
Ideally the SockJS server, considering it still uses gorilla/websockets as a dependency would automatically accept proper websocket connections, but barring that it seems I'd need a SockJS client library in Go which, as far as I can tell, doesn't exist.
Does anyone have a solution for this? Thanks!

Is it possible to maintain multiple clients in NanoHttpd?

I am trying to build a simple server/client application where the NanoHttpd server communicates with the client using WebSockets.
The server replies back with the same text that the client sent.
Is it possible to broacast messages to all the clients connected?
Any links about Nanohttpd with multiple-clients connected would be helpful.
https://github.com/PathikDevani/NanoHttpd-Demo
check my github project. here some example for multi user handle on websocket.
-------link is broken now

How to develop web sockets in worklight

I have an android application developed with IBM Worklight, in which a html file is making http request every 5 seconds and fetching the data from the server. Now I wish to replace this with HTML5 web sockets. But I wish to use the Worklight capabilities.
Is there anything like HTTP Adapter in Worklight for web socket?
If not could anyone please give any pointer about how to achieve it in worklight?
Is there anything like HTTP Adapter in Worklight for web socket?
No. At least to the best of my knowledge.
If not could anyone please give any pointer about how to achieve it in
worklight?
Web Sockets are not supported on Android (2.1-4.2): http://caniuse.com/#search=web%20sockets
However, you can try a Cordova Plugin like WebSocket-for-Android. There's a blog post that may help here. I just got those links for a quick Google Search.

Resources