没有任何数据可供显示
| 开源项目社区 | 当前位置 : |
|
| www.trustie.net/open_source_projects | 主页 > 开源项目社区 > gwt-comet-streamhub |
|
gwt-comet-streamhub
|
| 1 | 0 | 27 |
| 贡献者 | 讨论 | 代码提交 |
Project DescriptionA GWT Module for using Comet with StreamHub.
What is StreamHub?StreamHub is a Reverse Ajax & Comet server written in Java. A free Community Edition is available. For more details and to download it, visit the website: StreamHub - The Reverse Ajax & Comet Server.
JavadocStreamHub GWT Adapter Javadoc 1.0.4 StreamHub Java API Javadoc 2.0.9 Quick Start: Using the module in GWTAdd the following to your GWT module ( the .gwt.xml file):
Add the following JAR to the classpath:
streamhub-gwt-adapter-1.0.4.jarDownload the latest version of StreamHub and add the streamhub-min.js file to your HTML host page:
Now you're ready to go. To connect use the following code:
StreamHubGWTAdapter streamhub = new StreamHubGWTAdapter();
streamhub.connect("${server.url}");To subscribe you'll need to create a class which implements StreamHubGWTUpdateListener. For example:
public class StockListener implements StreamHubGWTUpdateListener {
public void onUpdate(String topic, JSONObject update) {
String lastPrice = ((JSONString)update.get("LastPrice")).stringValue();
String companyName = ((JSONString)update.get("Company")).stringValue();
String percentChange = ((JSONString)update.get("PercentChange")).stringValue();
String change = ((JSONString)update.get("Change")).stringValue();
}
}Then call subscribe on the adapter passing through the topic and your listener:
streamhub.subscribe("GOOG", new StockListener());IMPORTANT: Working in hosted mode and compiled modeAs of version 1.0.3 and greater, the GWT Comet Adapter only works in compiled mode. We are working with the GWT team to produce a working hosted mode in future versions.
If you are using an older version, you may still be able to get it working in hosted mode by removing the cross-site linker:
Examples and DemosThere are two GWT examples available to view on the StreamHub Examples page. The source for the adapter and the examples is available via the Source tab.
An Ext GWT demo is available in the StreamHub SDK version 2.0.10 and greater. Visit the StreamHub download page to get the latest version of the SDK. The source for the Ext GWT demo is available under the Source tab and is located at trunk/ExtGwtApp.
Troubleshooting and bug reportsPlease report any problems on the Issues tab by creating a new issue. Otherwise they won't get fixed.
标签:
