2

Is it possible to implement a custom WebSocket app in Java without having to run it on a Web-Server like GlassFish, Tomcat, Jetty etc?

I intend to develop a very custom-tailored App and would like to implement my own way to manage threads, monitoring, load balance, messaging and stuff like that. (compared with e.g. Java TCP’s ServerSocket ) I know there are Tyrus containers such as Grizzly integration for standalone server and Servlet support and here is Jetty as well, but I am not sure if that is what I am looking for. Is Grizzly or Jetty perhaps a standalone solution per se? I know Tyrus is some kind of wrapper for Grizzly WebSocket Implementation but to be honest, I am not sure how those two are interconnected.

Any suggestions are more than welcome! Thank you!

2 Answers 2

2

Tyrus is not "some kind of wrapper of Grizzly", but it can run on top of it.

(Tyrus is Reference implementation for WebSocket API for Java (JSR 356), which is part of Java EE).

Running without web server (assuming you are talking about appserver or something "big") is perfectly possible and very simple, since we are using this for our "e2e" testing. (I'm Tyrus developer if that matters).

Starting new container which can process WebSocket connections is as simple as: Main.java , see project declaration [pom.xml] for complete list of dependencies.

Sign up to request clarification or add additional context in comments.

Comments

1

In other words, you're trying to implement a WebSocket server, something like: https://code.google.com/p/jwebsocket/ (link is dead)

http://jwebsocket.org/downloads/jwebsocket-latest-versions (new link)

3 Comments

Thank you for your answer! Yes, a WebSocket server is something I want to build. Something like jWebSocket, but of course not as complex and comprehensive. I've glanced at jWebSocket's docu and they use their own internal TCPEngine but also a third party engines like Netty or Jetty. Based on that, I assume it is possible to implement a standalone server driven by, for instance, JettyEngine (?)
Yes that's entirely possible, although it might become very complex (depending on which parts you will be writing from scratch). As far as possible I would recommend reuse - so choosing your "blocks" as large as possible. But the sky is the limit - you could even go down to protocol level if you want to :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.