问题描述:

I want to implement Reverse AJAX using DOJO javascript framework.

Does DOJO provide support out-of-the-box similar to others like DWR?

I am using the latest DOJO.

Any reference/examples would be great.

Also what changes would need to be done on the server-side ? I am using Java.

网友答案:

Well, there is the dojox/socket module which allows you to any WebSocket or Comet (= HTTP long polling) solution.

An alternative is the CometD project, this is a solution that uses long polling and allows you to communicate with Java applications (using the CometD Java library) and JavaScript applications (using the CometD Dojo library).

However, it is not out of the box with Dojo but is a separate project (the JavaScript lib was included in older versions though).


Your code setup will change, obviously. First you need to be able to run the CometD Java service, and then you can use ServerSession to publish data or ClientSession to subscribe at the Java side. Going into detail would be too broad, but you should probably read the reference guide.

相关阅读:
Top