In Ubuntu, you create init scripts using the SysV init system. Details are here. In this article, I will create a very simple script to start and stop Tomcat.
One of the biggest advantages of WebSocket is that a server can now push event notifications to clients without any request (or solicitation) from the client. Example of this will be a client that displays live stock prices. When a price changes, the server can push the new price to all clients.