It’s the Web, just Kwwika

The real-time web. Delivered. 
Filed under

Real-Time Data

 

Keeping instantly up to date with the Cricket World Cup 2011 using the Opta Sports Real-Time Cricket Widget

Posted by email 

Comments [0]

Kwwika Powered Real-Time Opta Sports Cricket Widget

Over the past couple of weeks we've been involved in developing a Real-Time Cricket widget. It's been a collaboration, with Opta Sports providing the data, Kwwika powering the real-time client push as well as doing a bit of dev on data architecture and feed parsing and Matador Digital helping us build the widget itself.

Scorecard_green

There's quite a bit of work gone into this widget in a short space of time and I'm really pleased with the result. I'll go into exactly how it was built in more detail in a later post but for now i'll focus on what the widget can do and be used in this post.

Features

Opta Sports have created a an overview page for the widget which details the features at a higher level but I'm going to drill down a little bit deeper into the tech and explain how easily the widget can be embedded on any website.

Real-time ball-by-ball updates

For each event that occurs within a cricket match Opta Sports generate a feed. We get this feed, parse it and push it through Kwwika and into the web page. This means that every event is displayed on the widget.

Show either full scoreboard or simple match status

Ok, we finally get to see how you embed the widget in your page. It's simple!
opta.cricket.widget("#scorecard-wrapper",
    {
        style:"scorecard",
        gameDirectory:"/OPTA/CRICKET/FIXTURES/AUSTRALIA_V_ENGLAND_ASHES_2010-11/20101216/3RD_TEST"
    }
);
The first parameter you pass to the opta.cricket.widget function is a jQuery selector. This tells the widget where it should be created. If the selector matches multiple elements then you'll get multiple widgets. You probably wouldn't want this but it's a cool trick. The widget will replace the contents of the selected element(s) so until the widget loads you can have some HTML that says the widget is loading or just some static cricket data. If the widget can't load for any reason then the contents of the element(s) won't be replaced. This won't happen though ;)

The second parameter is options for the widget. We have a number of options that we support but the example above shows:
  • style: The widget can be created in a number of forms and this option parameter indicates how the widget should be displayed:
    • scorecard: This style is the full scorecard for an innings. This displays an overview section and all batsman and bowler information.
    • mini: This style is very similar to the scorecard. It displays the overview section and just the batsman and bowlers that are active.
    • overview: This style shows just the overview section of the widget.
    • livescores: This style just shows the current score in a smaller widget area.
  • gameDirectory: This identifies the Kwwika topic to request for the game and the data for this game will be displayed in the widget. The following topic is used for the 3rd test of the Australia v England Ashes 2010 to 2011 series: /OPTA/CRICKET/FIXTURES/AUSTRALIA_V_ENGLAND_ASHES_2010-11/20101216/3RD_TEST
(download)

We also have a few other option parameters:
  • innings: The widget defaults to displaying the latest available information. However, we cache some of the cricket data so it's possible to display the data for an earlier innings from a match by passing in an innings number.
  • flashTime: When an update occurs such as a run being scored or a bowler bowling a batsman out we flash the widget. This allows you to set how long the flash will last for.
  • title: This is displayed at the top of the widget if it is in the livescores style.
  • topicErrorMsg: A bit techie. If you have entered a gameDirectory that doesn't exist then the widget displays an error message. This allows you to configure what that error message says. It can contain HTML.

Developed using Kwwika technology for instant data streaming

Yep, it's the real-time web. Delivered ;) Do you have any data that you want to instantly distribute to any web-enabled device? If so, get in touch

Easy to customise - apply your own styling and branding

Since the widget is purely HTML and we've styled it with CSS you can easily customise the widget. Aaron Basset of Matador Digital did a great job when I asked him to supply a few different stylesheets. He told me that he'd used LESS to generate the CSS for the widget so it was easy to create different styles. Within 15 minutes Aaron had sent 10 different styles my way. You can apply the different styles in our example pages by just changing the drop-down at the top-left of the page. My favourites are the Kill Bill or Comic styles.
(download)

Can be embedded anywhere within the website with just three lines of code

We've classed the HTML container element for the widget and the single widget script include as lines of code which bumps this up to 3 lines. I've used a number of widgets in the past and I think we've done a great job here.
<div id="scorecard"></div>
<script src="http://cdn.kwwika.com/widgets/opta/cricket/opta.cricket.js"></script>
<script>opta.cricket.widget("#scorecard-wrapper",style:"mini",gameDirectory:"/OPTA/CRICKET/FIXTURES/AUSTRALIA_V_ENGLAND_ASHES_2010-11/20101216/3RD_TEST"});</script>

Okay, that last line is a bit long and maybe counts as 4!

Multiple matches on a single web page

You can call opta.cricket.widget as many times as you like and for each call you could pass a different game directory. That way you could easily have multiple games displayed on the same web page if you liked. You could also mix the styles of widgets that are on a web page.
Mixedwidgets

I want that widget!

Opta Sports specialise in high quality sports data. They have a number of sports products and this real-time cricket widget is the latest such product. Opta Sports are looking for companies who are interested in taking this widget and embedding it on their website or within their web application. If you are interested please get in touch with us or or directly with Opta Sports via their cricket score centre page.

Since the ashes are nearly at an end we will also consider allowing you to embed this widget free of charge on your website for the remaining Ashes matches. Just get in touch.

I want the cricket data!

One of the things that excites us about this widget is that we are now seeing high quality sports data streaming through our servers. We've also proven that Kwwika is a fantastic distribution channel for real-time data. And we've seen that the delivery speeds between the data being captured and appearing on a web page are fantastic! We hope that this is the start of a big DAAS (Data as a Service) trend and that Kwwika can be at the forefront of it.

If you like the widgets but you'd love to just get hold of the raw data and build your own widget, web app, mobile app or desktop app then please get in touch too.

Examples

You can find a link to all the the live examples on Opta Sports - Cricket Match & Events Centre demo page.

The above examples are hard-coded to show the Ashes 2nd Test but here are the Scorecard widget links to allow you to view the data from the 3rd and 4th tests:
From the format of the above links I'm sure you'll be able to work out how to view the other examples with different games :)

Additional: You can also see the South Africa v India test using this topic:
/OPTA/CRICKET/FIXTURES/SOUTH_AFRICA_V_INDIA_TEST_SERIES_2010-11/20101216/1ST_TEST

Thanks

Last but certainly not least, a bit thanks to everybody we worked with on this.

Opta Sports

A big thanks to Opta Sports for working on this product with us and giving us a chance to show off our technology. Working with Alon in particular has been a pleasure.

Matador Digital

We'd also like to thank Matador Digital for the UI work and doing the majority of the widget functionality (I couldn't help "lending a hand" though). Dave did a great job helping us come up with the UI and Aaron never ceases to amaze me with little pieces of information that make daunting tasks seem so simple. Really appreciate your hard work guys!

Filed under  //   Cricket   Opta Sports   Real-time Data   Sports   Widget  
Posted by email 

Comments [0]

Plotting tweets in real-time using Smoothie Charts and Kwwika

I noticed a tweet today about real-time JavaScript charts and couldn't resist having a play. The charts are call Smoothie Charts and have been developed by Joe Walnes. You can read the blog post where he announced the release of them here.

The demos that I've seen don't use real-time data so I thought I would create a small demo using real-time tweets being pushed through Kwwika. I updated the Kwwika TweetStreamer component (which I must get around to putting in GitHub) to push through updates from some popular hashtags including #nowplaying, #news, #tech and a few others and then wrote a bit of code to count the number of tweet updates over an interval and push that value into a Smoothie chart. The result looks like this (Smoothie charts use Canvas so only work in some browsers. I've tested this demo in Firefox and Chrome):

Smoothie-charts-kwwika-demo

You can see the Smoothie Twitter Real-Time Charting demo using Kwwika here: http://kwwika.com/Standalone/Demos/javascript-examples/smoothie-twitter-charting/

I've got the Smoothie chart showing the number of updates for each twitter hashtag, a table showing the count and a list of the tweets at the bottom.

The code is in GitHub so feel free to fork/download and have a play yourself. You can run the code on http://localhost but in order to get the code to work on your own website you'll need to register with Kwwika and get in touch to let us know you want access to the real-time Twitter hashtag topics.

Update: We found a bug in the Smoothie library which Joe Walnes promptly fixed.

One thing we've noticed is that the Smoothie chart stops working and throws an exception and as yet we've not been able to work out what the problem is due to lack of time. It's probably something to do with not getting any updated values in a TimeSeries. This is what the exception look like in Firebug:

Smoothie-error

If anybody can work out what the problem is please let us know. Failing that we'll look into it when we can.

Filed under  //   javascript   real-time data   real-time push   smoothie charts   twitter  
Posted by email 

Comments [3]

New World Cup 2010 Data Available for Web Development competition

We've had a few request for some additional World Cup 2010 data to be pushed through Kwwika for our World Cup competition. This new data has led to the introduction of a number of new topics.

  • /OPTA/WC2010/TEAMLIVE2 - if a second game is also being played live the data will be available here. This will actually be required from the group final games onwards. So, as of today.
  • /OPTA/WC2010/PREVGAME and /OPTA/WC2010/PREVGAME2 - Some information on the last two games that were played.
  • /OPTA/WC2010/NEXTGAME and /OPTA/WC2010/NEXTGAME2 - Some information on the next two games that are to be played.
You can find out more about the new data and view the live data and fields in the Opta Data section of the World Cup competition page.

We also have requests in to clear down the TEAMLIVE data once a new game kicks off. At the moment some data hangs around from the previous live game.

Opta are also sending us data such as player, substitute and goal information but we're not pushing that through Kwwika at the moment. If you really want this data then please get in touch or post a comment to let us know.

Finally, if you've not entered our competition yet it's not too late to do so. The entry submission deadline is 1st July at 22:00. Even after you've submitted your application you can continue to improve it although we'll obviously take it into account when we do our judging.

Filed under  //   Competition   Real-Time Data   World Cup 2010  
Posted by email 

Comments [0]

Want to try out the Kwwika API but don't want to register?

We're try to get more and more people using Kwwika and we feel that registering is maybe a barrier to entry. So, we've decided to give everybody access to our service. The only caveat is that we've just enabled access from your local development machine, assuming you can run a local application from http://localhost.

So, if you want to try out the Kwwika JavaScript API but don't want to register (yet), then go ahead. There's a topic that you can subscribe and publish to named /KWWIKA/SANDBOX.

You can even start building a Kwwika World Cup 2010 Real-Time Push Web App because we've give http://localhost access to the data you need to use to enter the competition:

/OPTA/WC2010/TEAMLIVE
/KWWIKA/TWITTER/SEARCHES/WC2010/*

If you need help getting started you can of course get in touch or start by going through our Real-Time Web Workshop. This workshop contains a presentation, a set of exercises and all the files (download) that you need to go through the exercises. This even in includes and executable webserver to run on windows, a webserver app to run on Mac and a python webserver to run on Linux (or any other python enabled machine).

So, why not start developing using Kwwika now. And if you like it, or are just damn good at developing real-time push apps, why not register and enter our World Cup 2010 competition.

Filed under  //   API   JavaScript   Real-Time Data   Real-Time Push   Real-Time Web  
Posted by email 

Comments [0]

Kwwika World Cup 2010 Real-Time Push Web App - Apple iPad competition - Sponsored by TellyLinks.com (Update)

Hello!

You are receiving this because you registered your interested in Kwwika Beta Access. Maybe you are using Kwwika already. If so, please get in touch with any feedback you have. If you want access but we've not given it to you yet please yell at us and we'll set you up.

So, this competition: We are trying to get people involved in using Kwwika so we thought we'd create a competition, sponsored by TellyLinks.com, to do so. You can win an Apple iPad just by building a cool web application using Kwwika and the real-time data we are publishing from Opta Sports or #worldcup Twitter updates. We've only recently added the Opta Sports updates and we're really excited that we are instantly getting information about live World Cup 2010 matches. This really world class data will give any developer out there the opportunity to create an engaging and potentially viral application which could draw a massive audience. So, if the Apple iPad prize isn't enough surely the opportunity to build a viral application is compelling!

So, why not get starting building your Kwwika World Cup 2010 Real-Time Push Web App.
Any questions, queries, thoughts, ideas, opportunities, competition help, anything - please get in touch.

Hope you are all enjoying World Cup 2010!

Kind regards,

Phil Leggetter
t: +44 (0)207 193 9499
http://twitter.com/leggetter

Kwwika
The real-time web. Delivered.
http://kwwika.com
http://twitter.com/Kwwika

Filed under  //   Competition   Email   Real-Time Data   Real-Time Push   World Cup 2010  
Posted by email 

Comments [0]

jQuery Real-Time Push Kwwika Plugin v0.1 released

Kwwika already makes it really easy to add real-time push functionality to any web page or website but we've gone a little bit further to try to make it even easier by writing a small but powerful jQuery plugin.

 
The jQuery Real-Time Push Kwwika Plugin allows you to define elements within a web page that you want to be updated with real-time data as soon as it's available. Anybody that has used a jQuery plugin should find our jQuery plugin really simple to use.
 
Here's how to use it.

Register for the Kwwika Beta programme

In order to use Kwwika you must first register so we can set up permissions within the Kwwika system to allow your website/domain to receive real-time push data from Kwwika.
 
So, register for the Kwwika Beta programme now.

Include script tags

You need to include the core jQuery library, the Kwwika JavaScript API and the jQuery Real-Time Push Kwwika Plugin files in your web page:
 
<script
src="http://code.jquery.com/jquery-1.4.2.min.js"
 type="text/javascript"></script>
<script
src="http://api.kwwika.com/latest/"
type="text/javascript"></script>
<script
src="http://api.kwwika.com/latest/plugins/jQuery/jquery.kwwika/jquery.kwwika.js"
type="text/javascript"></script>

Define HTML

You define the topic to be requested from Kwwika by adding an attribute to an HTML element. The default attribute to identify the topic to request is data-topic. You identify the value to be placed within the element by adding a data-field attribute to the same element. In the example below if an update occurs on the /KWWIKA/TWITTER/SEARCHES/KWWIKA topic with a value for the ScreenName field it will be inserted as the html contents of the first <div> element.
 
We've decided to use attributes with a prefix of "data-" as the present HTML 5 draft suggests custom attributes should use this prefix.
 
Custom data attributes are intended to store custom data private to the page or application, for which there are no more appropriate attributes or elements.
 
<html>
    <body>
        <div data-topic="/KWWIKA/TWITTER/SEARCHES/KWWIKA"
     data-field="ScreenName"></div>
        <div data-topic="/KWWIKA/TWITTER/SEARCHES/KWWIKA"
     data-field="Text"></div>
    </body>
</html>

Call the jQuery plugin

You call the jQuery Real-Time Push Kwwika Plugin in the same way you call any other jQuery plugin, by supplying a selector to the jQuery method ($) and calling the kwwika() function.
 
<script type="text/javascript">
    $(function ()
    {            
        $("div").kwwika();
    });
</script>

Examples

You can find three examples of how to use the jQuery Real-Time Push Kwwika Plugin from the links below:
 
The jQuery Real-Time Push Kwwika Plugin examples can be found on the API site:

Plugin Files

The plugin files are hosted on our API server. You can either download them and host them yourself or your own server:
 
 
Plugin Web Page

The jQuery Real-Time Push Kwwika Plugin has a dedicated page on the Kwwika Wiki:

Filed under  //   Kwwika   Real-Time Data   Real-Time Push   Real-Time Web   jQuery   jQuery Plugin  
Posted by email 

Comments [0]

Add real-time news to your site with Google. Add any real-time data to your site with Kwwika

It's been revealed that Google are going to release a version of their API that supports Real-Time news push. Real-time push technology has been around for ages and there are a number of technologies that allow you to host your own real-time push server. However, more recently hosted solutions have come about. Kwwika is one of these solutions.

However, why restrict yourself to just news updates when there are services such a Kwwika that allow you to add real-time push containing any data to your website!

If you have data that you want to push your data in real-time then you can use Kwwika to easily and instantly distribute your data to thousands of users. This can be great for showing the quality of your data and proving you use the most up to date technologies to give your data consumers a massive advantage. If you want to add real-time data to your website then you can easily subscribe to data and have it update instantly in your website.

Why not get in touch with Kwwika or sign up for the beta programme and see how you can either real-time push your data or add real-time push to your website, Rich Internet Application (RIA) or desktop application.

Filed under  //   Google   Kwwika   Real Time Web   Real-Time Data  
Posted by email 

Comments [0]

Kwwika Silverlight API - Chat Example

This video shows a chat application built using the Kwwika JavaScript API and a chat application built using the Kwwika Silverlight API. Both applications can communicate with each other in real-time using the Kwwika service.

We'll release the source code for both applications in the very near future.

Filed under  //   API   Chat   Example   JavaScript   Kwwika   Real Time Web   Real-Time Data   Silverlight  
Posted by email 

Comments [0]

#LeadersDebate demo retrospective

Following on from the first #LeadersDebate demo blog post we thought it would be good to look back on how we built the demo, how it performed on the two debate evenings and determine what worked and what did not.

 
We'd hoped to be able to do more to improve the performance of the #LeadersDebate demo between the second and final debate but time constraints mean we only just managed to make one improvement. This improvement was to remove the retweets (RT) from the demo. This meant that the tweet mention count better reflected unique tweets and the amount of data being pushed through the Kwwika service, and more importantly, to each web browser viewing the demo.
 
The latter is where the demo really fell down on each of the debate evenings. During the one and a half hour event last night around 120,000 tweets were made containing the tag #LeadersDebate. This means that on average there were over 1,300 tweets per minute and over 20 tweets per second.
 
How much data?

The amount of data that we are talking about probably isn't too much data for a web page to handle until you drill into the contents of the data and look at what is being done on the web page itself.
 
Only a small amount of the tweet data being sent to the browser was actually being displayed. Here's a sample message:
 
Firebug_mupdate
 
In the case of the #LeadersDebate demo we only really needed ScreenName, Text, UserProfileImageUrl, TotalTweets and sometimes the reply based fields. If we had only sent through the data we actually needed this would have made a small, but useful, dent in the amount of data the web browser would need to process.
 
What did we do with the data?

Calculations

Once we had received the data we did a few calculations. We worked out the total number of tweets received for all the leaders together. So, TotalTweets could be 136,690,  BrownTweets 31,020, CameronTweets 38,313 and CleggTweets 28,704. So, the total leader tweets would be 98,037 (31,020 + 38,313 + 28,704).
 
Leadersdebatetotals
 
On top of this we also converted these figures into percentages. Brown on 32% (31,020 / 98,037), Cameron on 39% (38,313 / 98,037) and Clegg on (28,704 / 98,037).
 
Leaderspercentage
Although these are simple and small calculations they were performed each time there was a tweet update; 20 times a second.
 
Filtering
 
Since we were receiving all #LeadersDebate updates but we wanted to make sure that each tweet was analysed to ensure that it went into the appropriate leaders' column. So, as each tweet came in we would perform a textual match on the tweet message (mUpdate.Text). This was done once per column for each tweet and there were also multiple filters to check against e.g. for David Cameron we filtered on David, Cameron, DC, Dave, Tories, Tory, Conservatives and a few others.
 
We also added the ability to live filter the far left column. We did this using some jQuery selectors and if you'd have tried this as the debate was happening it is more than likely that your browser crashed.
 
The main thing to learn here is it's still much better to do intensive work such as this in the Kwwika.NET application that is consuming all the data in real-time from the Twitter Streaming API. We were publishing all #leaderdebate tweets on the /KWWIKA/TWITTER/HASHTAGS/LEADERSDEBATE topic when instead we should have published things on different topics to allow the web browser client to concentrate on just displaying the data. Maybe having a few topics like this would have worked:
  • Tweet Counts and statistics: /KWWIKA/TWITTER/HASHTAGS/LEADERSDEBATE/COUNTS
  • Brown Tweets: /KWWIKA/TWITTER/HASHTAGS/LEADERSDEBATE/BROWN
  • Cameron Tweets: /KWWIKA/TWITTER/HASHTAGS/LEADERSDEBATE/CAMERON
  • Clegg Tweets: /KWWIKA/TWITTER/HASHTAGS/LEADERSDEBATE/CLEGG
  • Tweets that didn't mention any leader but still contained #LeadersDebate: /KWWIKA/TWITTER/HASHTAGS/LEADERSDEBATE/OTHER
Using this all count and percentage calculations could have been done within the Kwwika.NET application, which was running on a web server, and pushed to the /COUNTS topic, all tweets about specific or multiple leaders could have gone to the appropriate leader topic, /BROWN, /CAMERON, /CLEGG and all others to /OTHER. The Brown column would display all /BROWN tweets, the Cameron column all /CAMERON tweets, the Clegg column all /CLEGG tweets and the all column would combine /OTHER, /BROWN, /CAMERON and /CLEGG.
 
It's potentially a bit more complex this way, since the Kwwika.NET API application has to analyse tweets and publish them to different topics, but it certainly take all strain off of the client.
 
How was the data displayed?

As mentioned in the first #LeadersDebate blog post we decided upon four columns. One for each leader and one to display all the tweets. The columns were formed from a Kwwika Twitter Widget that we've built and we enhanced it to allow us to make it a bit more configurable. You can see the widget standalone on the About Kwwika page. We also decided to use two Google interactive charts to provide a visual representation of the data as it arrived in real-time.
 
One of the enhancements we added to the Kwwika Twitter widget was to add some jQuery effects to allow the tweets to slide down into view. At low update rates this is a really nice effect. At higher update rates your browser is unlikely to cope.
 
The charting components are also a really nice effect at lower update rates but as soon as the update rates increase they don't really cope.
 
Bug!

Yep, we admit it. There was a bug in our code. If you viewed the demo and things appeared to be working fine for you but then you stopped getting updates you've probably been bitten. We'll fix this in our core library very soon.
 
What did we prove?
 
We've proven that our Kwwika technology is clearly the bees knee's. We had absolutely no problems within the Kwwika service or within our Kwwika.NET application. We also think that the JavaScript Kwwika API held our well with the exception of the bug we've found.
 
The main thing for us is that it was very clear during the 20+ tweets per second period that there was no way that any human being could actually read the tweets. The statistics were very interesting so maybe the demo should have concerntrated on that rather than the individual tweets. If we'd have done this and done the tweet analysis in the Kwwika.NET application running on a server then the web browser would have had absolutely no problem at all dealing with the update rate.
 
Browsers
 
It's potentially a little unfair to suggest a best browser since our bug mean using some other browsers was pretty tricky. However, for us, Chrome seemed to stand up to the update rate and seemed to work around the bug far better than Firefox or Internet Explorer.
 
Conclusion
 
By considering the following we would certainly be able to improve the #LeadersDebate performance and user experience:
  1. Do a little calculating and analysis in the client as possible when you are dealing with high volume data.
  2. Organise the data so that the client doesn't have to.
  3. Only send that data that is needed to the web browser. Don't send unused fields.
  4. Consider the update rate. If the target consumer is a human being will they be able to read the data?
  5. At high data rates visual effects and charting components don't seem to work in a web browser. For charting consider pulsing the data or only making an update at set intervals.
  6. We could certainly dig even deeper into the causes of the browser slow down by using tools to analyse bottle necks and potential areas for memory leaks within the browser.
 
We'll give you the code

We built this as a demo. It's not a product. So, if you would like to build something similar and want a starting point we are happy to have a chat and give you the code. So, get in touch.

Filed under  //   Kwwika   Real-Time Data   Real-Time Web   Retrospective   Twitter  
Posted by email 

Comments [0]