Subscribing to more than one topic and user experience (UX) considerationsShow multiple tweetsUpdate your topicUpdated code to prepend new tweets to the latest results element. This should ensure that the latest result is always at the top. Subscribe to multiple topicsIt's possible to subscribe to more than one topic at a time. Update your page to subscribe to an additional topic that contains real-time updates for all tweets containing the#spa2010 hashtag.
Subscribe to /KWWIKA/TWITTER/HASHTAGS/SPA2010
Coping with large amounts of dataOnce the web page has received a lot of updates the memory used by the browser will increase. The page will also become visually very large. A good way to work around both of these problems is to remove older tweets.
Restrict you webpage to show only 25 tweets at any one time and remove any older tweets.
Add detail to your web pageA tweet contains more than just a ScreenName and Text. It also contains information about a user profile image and the time the tweet was sent. Consider adding the following pieces of information to your displayed tweets.
The available fields are:
ExtraThe topics that we are subscribing to don't update all that often. Try subscribing to /KWWIKA/TWITTER/HASHTAGS/NOWPLAYING and consider how you would deal with this within your web application.
Hints & Tips
// Define a subscription listener object. var oSubscriptionListener = function() { this.topicUpdated = function(oSub, mUpdate) { // handle update }; this.topicError = function(oSubscription, sReason) { // handle errors } } var oSub = oConn.subscribe("/KWWIKA/TWITTER/HASHTAGS/TECH", oSubscriptionListener); var oSub2 = oConn.subscribe("/KWWIKA/TWITTER/HASHTAGS/SPA2010", oSubscriptionListener);
The next exercise is Exercise 4: Chat |
