It’s the Web, just Kwwika

The real-time web. Delivered. 

Kwwika Service to cease operation on 1st June 2011

Unfortunately the decision has been made to cease operation of the Kwwika service on 01/06/2011. I'm sorry for the short notice and any inconvenience that this may cause.

I will be moving to Pusher who offer a fantastic real-time messaging service, similar to Kwwika. It would be great if you would join me there.

If you have any questions at all, or would like some help migrating to Pusher, please email me directly using phil@pusher.com.

Thanks for your interest in the Kwwika service.

Best regards,

Phil Leggetter
@leggetter

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

Posted by email 

Comments [0]

Dynamically sorting a table with jQuery tablesorter plugin

I'm in the middle of building our user dashboard and have been using jQuery extensively to add a rich feel to the UI. Since our focus is data it's not surprising that I have some tables in our UI. I decided I should add some sorting functionality to the table for a couple of reasons; Iare dynamically adding rows to the table when new data is created and I also want Kwwika users to be able to sort tables to help them find data.

Rather than write some JavaScript from scratch, and was the case for many years, I automatically did a search for jQuery sort plugins and I managed to compile a list of few that seem to work or at least have potential. I eventually decided to go with tablesorter since it's been around for a while, is pretty stable, the code isn't too complex for what shouldn't be a complex thing and the styling was also nice an basic and could easily be customised.

We got the manual sorting functionality up and running really easily and I then added a couple of calls to first let the plugin know the data had been updated and then to tell the plugin to sort the table. Here's the code in its simplest format.

Tablesorter-demo

When you click the add button eventually the table.trigger("sorton", [[[1,0]]]) is called. The first parameter is the method to be called and the second parameter is something the documentation refers to as a sort list (important note: this parameter should be an array of parameters as defined in the jQuery trigger docs - this got us for a bit):

An array of instructions for per-column sorting and direction in the format: [[columnIndex, sortDirection], ... ] where columnIndex is a zero-based index for your columns left-to-right and sortDirection is 0 for Ascending and 1 for Descending. A valid argument that sorts ascending first by column 1 and then column 2 looks like: [[0,0],[1,0]]

But it doesn't work!

Those of you who have worked with JavaScript for a while will probably be aware that it's single-threaded (for getting Web Workers) and that queued scripts only get a chance to execute either when one finishes or a setTimeout is called. My hunch was that something within the "update" trigger call had pushed some execution into a setTimeout call so to work around this I needed to do the same for my "sorton" trigger call to make sure that all other processed had finished execution and the DOM and the tablesorter plugin were in the state I wanted to be in.

setTimeout(function()
{
var sorting = [[1,0]];
table.trigger("sorton", [sorting]);
}, 0);

It worked!

So, you'll be pleased to hear that the data tables within the Kwwika User Dashboard are nice and dynamic ready for users to find and organise their data.

Demo 

Here's a link to a working demo.

Here's a full working listing of some example code:

Filed under  //   JavaScript   UI   User Dashboard   jQuery   jQuery tablesorter plugin  
Posted by email 

Comments [0]

How to dynamically load JavaScript and CSS files

One of the requirements of the Opta Sports real-time Cricket widget (blog post | Opta Sports live cricket scores page) was that including the widget should be as simple as possible. One way to keep things simple is to only need to include one script tag which dynamically includes all required JavaScript and CSS files. We'd outsourced some of the widget development to Matador Digital and we passed this requirement on to them. They came up with a nifty bit of JavaScript that met exactly these requirements.

This example is tied to loading the files we required for our widget, including the Kwwika JavaScript API, but it wouldn't be at all difficult to take this code and create a small generic JavaScript and CSS loading utility function. The require function is generic and could easily be used as a solution to load any JavaScript or CSS file.

There are of course other solutions available:
A quick search will also come up with a number of solutions.

If you find any other solutions please get in touch and we'll update this post.

Filed under  //   CSS   JavaScript   Utilities  
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]

Kwwika support for webOS

We've got a potential client interested in using Kwwika on HP webOS so we've been working with them to test the Kwwika JavaScript library on a platform that we've not been directly targeting. After a problem glitch with the 64bit webOS DK (mainly JVM and PATH problems) we got the 32bit one up and running and the a webOS emulator fired up. From there Palm have created a really nifty web IDE called Ares. Ares communicates with the webOS emulator, which runs on Virtual Box, via the web browser Java plugin and it allows you to launch the application and debug it. This works surprisingly well.

We came across three problems with the Kwwika JavaScript API where we'd made assumptions that the library would be running within a web browser. We fixed this by stepping through the code with Ares debugger and soon we were connected, logged in, subscribing to data and publishing data.

The code is super-simple since it's just a normal HTML page:

And our application didn't have any UI but you can see from the log at the bottom of this screenshot that the Kwwika JavaScript library is working with webOS as expected.
Webos_ares

Filed under  //   HP   JavaScript   Palm   webOS  
Posted by email 

Comments [0]

the.meet140.com - real-time twitter updates by Kwwika

Aaron Bassett has just put together a site to allow anybody to follow tweets tagged with #themeet140 in real-time for all themeet140 events. Yep, you've guessed it. He's using Kwwika to push the twitter updates instantly into the website.

Themeet140website

Note: we've slightly altered the screenshot (ahem!) ;-)

themeet140 is described as:

A very pleasant, random crowd, gathering every so often. Unwittingly thrown together by Chris @chrish10 and Mark @markofrespect. The social in social media.

There is a themeet140 tonight in Glasgow and make sure you follow themeet140 to keep up to date with future events since they are held in London, Cheltenham and Glasgow.

We'd like to thank Aaron for again thinking of Kwwika when building this simple yet effective site.

Filed under  //   real-time push   real-time web   social media   themeet140  
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]

The benefits of Real-Time Push-Once

There's so much excitement about real-time push technologies that quite often, in fact almost always, the benefits of using push are overlooked, forgotten, or simply not known. The technology excites programmers who want to use it, want to know how it works or want to write their own push framework, user experience (UX) professionals who understand how this paradigm shift will massively benefit users, general technologists who can see how the addition of such technology can improve an application or product and entrepreneurs who have the vision to see ground breaking ways of using push. 

The understood benefits

The cost and resource benefits that real-time push bring start to be considered when the excitement of the technology dies down and you start talking in detail about using a Cloud Platform as a Service (PAAS) such as Kwwika. Kwwika provides the more obvious benefit of allowing anybody to publish and add real-time data to any web page, web application, Rich Internet Application (RIA), desktop or service application and share information between all these and from a number of different sources. The first thoughts of resource and cost saving are when you start to consider that by using a service you don't need to buy servers to host your real-time push servers, you don't need to spend time and effort installing, setting up and learning how to use the software, you don't need to worry about maintaining the software and handling upgrades and you don't need to worry about how you deal with scaling your servers to meet increased demand as well as keeping resource usage to a minimum during lean spells. Kwwika offers all the benefits of a hosted scalable service, but for real-time push streaming as a service. This means you can concentrate on building your application, developing your product or service and winning business.

The benefits of real-time push-once

The best way to understand one of the fundamental, but as yet hidden, benefits of Kwwika, and ultimately real-time push-once, is through an example:

Imagine a website known as the best destination for up to the second sports information for the newest and most popular sports of all time: Multiball. It's a mixture of all the most popular sports including football (soccer), baseball, basketball, rugby, tennis, cricket and motor sports. This new game is fast paced and jam packed with statistics which change every second. Today there is a really big game on between Great Britain and USA. The world wants to watch this game but it's during the day for many people who will be at work in front of their computers so they'll be logging on to this well known website to keep up to date with the scores. The game is tied in the 4th quarter with only 1 minute remaining and millions of users from around the world starting hitting the F5 key and clicking the "Refresh" button in their web browser to refreshing the website and check for the latest score. The servers hosting the website can't handle the load and crash.
1_request
Some websites try to get around this scenario by adding some script to their score web page which polls the server for an update at a set interval. The problem with this is that the web server still has to deal with, in effect, a refresh although the data returned to the request can be much smaller.
2_polling
The most obvious use of a real-time push system is that as soon as a server (or score system) receives new information it can push it to any application instance that is interested in that information. In the above Multibal' website example the application instance is each web browser session logged on to the website. If the sports website were using a real-time push system this would mean that they could instantly push any changes in the score to each web browser session which would mean that each website user wouldn't need to refresh their page (reloading the whole page) to check if the score had changed.
3_push
This alone would take a massive load off of the sports website infrastructure, but it's possible to take things even further.

Even in the real-time push scenario the sports website would need to build and maintain the real-time push infrastructure and push an update to each of the millions of website users. From the information above you'll know that real-time push services can help them out with the infrastructure. The new, and game changing feature that Kwwika offers is that when Rooney Giggs McFadden makes that game winning manoeuvre-score for Great Britain the sports website would only need to publish the score update once into the Kwwika service (real-time push-once). Kwwika would then instantly distribute that update to the millions of website users. This means the website only ever needs to deal with single page loads from its users and push out each score change or game statistic once, Kwwika does the rest.
4_push-once

Thanks to Zen Elements Web Design & Development for the diagrams

Filed under  //   cloud   comet   paas   platform as a service   real-time push   real-time push-once   real-time web   streaming as a service  
Posted by email 

Comments [0]

Kwwika-Superfeedr real-time demo available

Over the past few weeks we've been dabbling with first creating a PUbSubHubbub Subscriber and then building a cool real-time demo which integrates the real-time feed goodness from Superfeedr with the real-time client push wickedness of Kwwika.

The demo itself took a couple of days to build and allows a user to subscriber to any RSS feed or track any keyword using Superfeedr. When Superfeedr receives a real-time update it'll push that update to a web server which will then instantly push that update through Kwwika and into the demo web application.

RSS source → pubsubhubbub → Superfeedr → pubsubhubbub → webserver → Kwwika → Web client

The application shows RSS and track updates in real-time in a web client which you could think of it like a real-time push RSS reader. We're hosting the application and are restricting the demo to 10 subscriptions unless you have logged in to use your own dedicated demo. If you want your own dedicated demo then you'll first need a Superfeedr account and then get in touch with us at Kwwika and we'll set up the demo account for you on our servers. Once that's done you'll be able to log into the demo using your Superfeedr credentials. More information on setting up a dedicated demo can be found on the Kwwika Wiki.
Kwwika-superfeedrdemoscreen
If you are a developer you'll be pleased to know that the the source code for this application is available on GitHub. The code is an ASP.NET MVC solution although you could easily take the principles and create the demo in almost any other language. Just get in touch if you are interested.
It's also important to remember that this is a pretty simple demo and that this technology has a lot of potential. Even this demo can be improved in terms of usability, feed parsing to ensure all the information a user could need is pushed through, pulling in older feed items from some of the subscriptions, pausing updates, some general UI updates (which are in the pipeline) and so much more. Why not take the code and see what you can do with this? We'd be happy to help!

Here's a little walk through of the demo:

So, why not try out the Kwwika-Superfeedr demo and let us know what you think.

Filed under  //   RSS   real-time push   real-time web   superfeedr  
Posted by email 

Comments [2]