• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Access websocket sessions from external class

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there in way in tomcat 7.0.53 to access my websocket sessions on a websocket server as part of a web application from a external java class running in a daemon on linux where the tomcat server and webapp are deployed? If not what is the best way, if any without using sockets to be able to communicate from an external application written in java to the websocket server on my webapp?
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't played around with websockets yet, so most of what I know is theoretical.

You have to use sockets to talk websocket, because, well, it's websocket. Whether you code for raw sockets or via an abstract API, there will be a socket in there somewhere on the client talking to the websocket on the server.

Any program can talk to a webserver as long as it addresses the proper ports and uses the proper protocols. It doesn't have to be a browser app. I use telnet for basic diagnostics, for example. A number of stand-alone java applications serve as test runners for web testing. Adding websocket protocol to a client doesn't change that ability.

Stepping back specifically from websockets, one of the major predecessors to websockets is RMI. RMI is an efficient way for 2 or more Java apps to communicate privately in a conversational mode using simple Java method invocations for APIs that you design. It serves as the underpinning for EJB remote objects, which are part of the core J2EE spec, although not natively implemented in Tomcat.

The primary advantage of websockets over RMI is that they aren't limited to java-to-java app communication and that they operate under web protocols.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic