@stanmiller thanks for your suggestion ... More or less I wanted to know if B4J or websockets had a publish or subscribe mechanism ... So let's take the following scenario: One of my users setups daily/weekly reports, so the next report will be schenduled for generation the next day ... As I will verify and generate reports using a server backgroundworker which check every hour if it has any 'job' to process I need some kind of publish/subscribe mechanism that when the report will be generated I will publish a message/notification to a channel where all users that find that report usefull (all users from an account) and are connected so they can update their view (put a badge on the topbar notification item and create a container in the notification extra sidebar) in realtime.
And as I said I created my own publish and subscribe mechanism using a code module with global threadsafe maps (a map for channels and subscribers and a map for messages). So when a user(page/server websocket class) subscribes to a channel it will be added to the subscribers list for the given channel and when a user or the server itself publish a message for a channel this message will be added to the message ts map (which acts like a queue). After this comes in the scene the queue processor - a server background worker that checks every second if it has any new messages, if it has then I use CallSubDelayed to call the sub from the subscriber that can handle the message - so it can run in the subscriber thread. This is how I done it (more or less
) and I must say it is working surprisingly well as I get the view (what users see in browser) updated with realtime data (this is what I needed).
This mechanism is usefull for many things like chat applications, collaborative applications (where one user makes a modification and the other users must see in realtime), showing server statistics with real time numbers (this is something that i will definitely need), etc... also using this kind of mechanism will need to have all the communication optimized as much as possible because as the user base will grow so will the bandwidth needed and used - I am long way from finsihing my project
)