Javascript file connect to external source using java action

Basically, i have a javascript code which i want to use to send messages like when a user adds information to a database. How can this be implemented using a java action
1 answers

Pushing messages to clients can be pretty complex, and a short question like this contains not enough information to give a sufficient answer. What javascript code do you use? To who do you want to send messages? What is the frequency? Expected number of users and messages?