Comet / Reverse AJAX methodologies


Has anyone tried to implement Comet aka Ajax Push aka Reverse Ajax with Outsystems?

I need to have realtime interaction in an application and right now I have a javascript timer clicking a button...(you know the pattern) to do my polling but doing this every second is not a feasible solution.  I was looking into Reverse Ajax pattern but I have the feeling it might be hard to do it with the agile platform.

Any thoughts on this?
Hello João,

Have you tried to use the Sync component?

I think this will do the job, by broadcasting data changes to everyone, or simply triggering refresh requests.
Hope this helps..

Best Regards,
Gonçalo Martins
Hi João,

Please note that neither IIS (until version 8, on Windows Server 2012) nor JBoss are suitable for long polling connections as they use a dedicate a thread to serve each request enabling you to exhaust the server with just a few simultaneous requests. Since OutSystems applications are deployed to those application servers, there's no really good way to do a comet application without using a separate component more suitable for the task.

I believe that component uses the same strategy I mentioned in my previous post, that is, a javascript timer that is running and clicking an hidden button that is calling some action...


Thanks for the insight.
Hello João,

I'm not sure about that and I believe that the Sync component is more complex and not the simple approach you took.
I never worked with it but I already have a conversation about this component with its author and I know that it is an excelent component...
It doesn't run a javascript reacts to events, i.e. you will not have so my refreshs,but a refresh when some event occurs, using xml to update the page/block information.
I don't know if this is "the component" you need but you should take a look at it...and it's much better (mostly performance) than the approach you are using at this moment ;)
If this don't work, I have to say that Miguel Ventura's post explains very well the issues about your need.

Best Regards,
Gonçalo Martins
Hi all,

Take a look at:

You can use it to implement Comet / Server-Sent Events / whatever. :)
Another good read:

Hi. :)
Unfortunately, yes, the Sync component uses polling as well.
It can get stressfull on the browser, so I tried to optimize the length of requests to help soften that issue a little bit.

At the time I also looked into comet and similar paterns, even fiddled a little bit with Node.js. They all seemed to need server-side code, from what I saw.
Personally, I didn't want to do this for code maintainability purposes.

What about HTML 5 Web Sockets? You'll have to forget about older versions of IE, but that might not be a problem in some cases... as long as you can convince the entire organization to change to a decent browser... 

Hi again!

For those looking into websockets for the first time this is a worthy read:

I'd advise against using websockets directly. Instead pick one of these solutions:
since they negotiate the best transport available across pooling, comet and websockets.

The libraries mentioned above are all open-source but if that's not your thing check these guys out:

Davide -

If we wanted to do something like this, is "use" or "" still the best recommendation? If so, how would we get OutSystems communicating with these?


Me and Leonardo Fernandes have implemented a Comet case in our project. A few planning brainstorming, AtmosphereJs at client, some Java code in an extension and everything is working like a charm till now. We are now measuring impacts on servers while we are still on a test phase. For now we can switch immediately to a polling refresh mecanism in case of performance or disponibility problems.
Hi Justin!
is "use" or "" still the best recommendation?
Totally! is the most popular one and you'll find a ton of information on how to use it.
how would we get OutSystems communicating with these?
You need to set up a NodeJS server alongside your platform installation and have it communicate with the platform (here's an example on how to do it:
That will give you something that works but a complete and scalable solution will involve a lot more. Dive into the documentation from Pusher/xrtml/ to see some of the things they solve for you.

Some of my colleagues have used NodeJS to create a chat & control Lego Mindstorms. Pinging then to share details on how they did it. ;)

Hi Justin

An approach that has been working for us is:
  • setup nodejs to serve both websockets (using and plain HTTP
  • when clients connect to the platform:
    • generate a token for that user, store it in the database and provide it in a script variable
    • also provide client script so the client now gets a persistent connection to the node server
    • once the client connects to node, it sends its token to node (node will associate the token string with the client's socket)
Under this setup, communication can work this way:
  • From client to server
    • normal GET / AJAX POST directly to the platform...
    • send message through websocket, let node handle it by making a request to the platform where it provides the message and the token (so we have a way to know which user sent the message)
  • From server to client
    • the platform makes a GET request to node providing the token of the user it wants the message to be sent to and the message
    • node will use the token to see which socket is associated with it and send the message to that socket
    • client gets it and handles it
Unfortunately I don't have at the moment a basic working example I can provide you with (I have some stuff I can't yet release) but I'd be happy to assist you in creating a component that could provide this functionality (which I might do but probably just after NextStep '14...).

Davide, Joao, & Miguel -

Thanks! We do not have a timeline for this functionality yet, but I will be sure to reach out to you when we take a closer look at doing an implementation. Right now we are trying to determine how this will work, level of effort, and so on.

Have there been any updates on the websockets in the last year?
I'm wondering if it is possible to start using this in an Outsystems Cloud environment.
No websockets on the OutSystems Platform yet, Remco.