Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to connect plain JAVA SE desktop application to WebSocket?  RSS feed

 
Sergey Lotvin
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, All! I have JAVA SE (1.8) desktop application. That app collect data via OPC from different devices. It also transfer some collected data to MySQL DB on cloud, so it works without stops, but this is not the case. The case now is how to show some data (for instance value of pressure on some pipe) and changes of its value in real time (forget about network delay) on web site. To better understanding I want kinda of web scada. Example -  http://www.inviewscada.com/web-scada/
I already have that web site on cloud. And I've opened web socket there, but have no idea how to send the message from my JAVA SE app to that opened web socket. Help me with with the road map what to do, please. Is it possible after all?
All I've found on the internet was regarding wbe sockets and communication between web applications.
 
Sergey Lotvin
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I should mention that I've connect web application with JAVA SE desktop application using and , but it's OK for localhost where I have freedom to allocate/open/close ports. Cloud service doesn't allow to open/close ports for external world (I'm using openshift). But OpenShift allows to use WebSocket on ports 8000/8443, that I want to exploit.
 
Tim Moores
Saloon Keeper
Posts: 3828
79
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The easiest way is probably to use a JSR-356 implementation that includes a client library, like Tyrus. Example code for that can be found at http://stackoverflow.com/a/21231344.
 
Rob Spoor
Sheriff
Posts: 21047
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've written a POC at work that uses Tyrus, so +1.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!