I am looking for more information that I cannot find in my searches of the web. I am most likely searching for the wrong thing and I hope someone can correct me.
I have implemented a client(javascript)-server(java) websocket application. I have the connections working for several clients and now I want to start with some initial data created from a main method. However, the main method I have in my java application is not linked to the websocket endpoint. So if I create object instances when I run the application I want that information to be sent to the connected clients outside of the closed loop of session actions.
What I am describing sounds impossible to but I am certain I am just not explaining it properly.
Conclusion:
When dealing with websockets, how can I have an OnServerStartup so to speak so that I can either load saved data or create initial data?
Background:
I have implemented an annotated server endpoint using javax.websocket.server. The history which due to going out of order may have caused my quandry is that I started with the java application first and then I wanted to have a client UI to add, edit, delete data. So I went with a javascript frontend communicating with my java app via websockets. Now my app cannot communicate with the websocket connections or at least I do not know how yet.
Ideally what I am trying to do is have the useractions come in over the websocket and then I want to put the actions into a queue that my application then processes. When complete it sends the resulting changes to the dataset to all active sessions. There is a big issue here because I want to initialize saved data before allowing the websocket connections. Also if I have a timed event I want to be able to send all the updates to the connected sessions.