0

This is my first time working with Java Websockets (not using Jetty, using JSR-356 instead), and all of the examples that I have seen utilize the "public static void main(final String[] args)" to map the Websocket client and server endpoints.

If I am creating an app based in a Java Servlet, then is that method necessary to connect the two socket endpoints? If it is necessary, then how does it even get called to perform that method in that connecting class?

1 Answers1

0

Your Servlet code does not have to have "public static void main(String[])" method. The method is the entry point which is used when you invoke the application from a command line interface. On the other hand, a Servlet is started in a different way by a Servlet container and so the method (public static void main(String[])) is not the entry point for Servlets.

Takahiko Kawasaki
  • 18,118
  • 9
  • 62
  • 105