The Simplest Way to Use Your Smartphone as a Game Controller: A WebSocket Race Car Demo

There are some solutions out there that turn your smartphone into a Wii-style controller, but many of them require a dedicated app on your phone and even a browser plugin on your desktop. With HTML5 and WebSockets you can achieve this very quickly and easily without the need of pre-installing anything on your machine or your phone.

All you need is:

  1. A desktop browser: The game is “hosted” by the desktop browser. It renders the UI of the game using HTML5 canvas and WebGL.
    Note: You can check here if your desktop browser supports WebGL.
  2. A smartphone (with a browser): Smartphones can take a variety of input source, like touch, tilt, GPS, proximity, compass, camera, microphone. Many of these input sources are accessible from JavaScript, allowing you to easily control your game.
  3. A WebSocket server: The desktop and the smartphone(s) have to communicate through a fast, low latency channel – exactly what WebSocket was designed to do. The WebSocket standard doesn’t provide pier-to-pier connectivity, so you’ll need a server that routes the messages between the smartphone(s) and the desktop.

If you use a WebSocket server, like the Kaazing WebSocket Gateway that provides higher level protocols on top of WebSockets, your architecture can be kept very simple. You don’t need to write a single line of server-side code, the JavaScript code running in the desktop browser and the smartphone does all the job.

To demonstrate the power of no server-side code, we built a demo using the Java Message Service (JMS) edition of the Kaazing WebSocket Gateway. The advantage of using JMS in your JavaScript code directly is that with the pub/sub model of JMS you can very easily direct the messages between the smartphone(s) and the desktop browser.

The flow for the player is very simple:

  1. Bring up the game in your desktop browser: http://demo.kaazing.com/racer
  2. Enter the URL in your smartphone browser, as shown in the bottom of the desktop browser: http://demo.kaazing.com/racer/ws
  3. Enter the unique ID when prompted by your smartphone. This unique ID connects the game instance running in your desktop browser to the smartphone you use as your remote controller.

The race car is controlled simply by tilting your phone. Tilting the phone triggers JavaScript events which result in JMS messages sent through the WebSocket gateway to the desktop browser.

Note: For this demo to work you need a smartphone that supports the JavaScript tilt APIs. We tested the demo with devices running iOS 4 and above.

After watching the video how it works, take it for a test drive.

Posted in Gaming, Kaazing, WebSocket | Leave a comment

HTML5 Live 2011 New York: HTML5 In the Enterprise – A Panel Discussion

Hear industry experts and executives talk about their HTML5 vision, the role of WebSockets, client technologies, browser plugins, and more in the enterprise. The discussion is moderated by Arik Hesseldahl from All Things Digital.

Panelists:

  • John Page: Director of Business Development, Messaging, TIBCO
  • Eric Newcomer: Chief Architect, Investment Bank, Credit Suisse
  • Paolo Pelizzoli: Vice President of Architecture and Development, Broadridge Financial
Posted in html5, WebSocket | Leave a comment

HTML5 Live 2011 New York: There is Just One Web

Jen Simmons, freelance designer, front-end developer, Drupal expert, trainer, teacher, conference presenter, and host of The Web Ahead pod cast presented about the mobile Web at HTML5 Live 2011, in New York: There is Just One Web.

Mobile is all the rage these days — and it should be. Many website owners believe creating a separate mobile website is the solution, with browser sniffing to redirect all “mobile” traffic to a separate m.example.com domain. But it turns out that most of the time this is a terrible solution. Come hear Jen Simmons talk about how there’s only one web — not a mobile web separate from the desktop web. And learn how you can use HTML5 and responsive web design to create one unified website or web app for your project and Just Have It Work™ on a wide range of devices.

Posted in Events, html5 | Leave a comment

HTML5 Live 2011 New York: A Snapshot of The Mobile HTML5 Revolution

At HTML5 Live James Pierce from Sencha presented A Snapshot of the Mobile HTML5 Revolution.

The premise and the promise of using web technologies for building mobile apps is well understood. But are we there yet? This presentation takes an honest look at the state of the art of mobile standards and implementations. We discuss what can be built, what has been built – and of course what will soon be possible – with these exciting tools and approaches.

 

Q&A: Why attend James Pearce’s talk at HTML5 Live in New York 2011

Q. Tell us a little about what you will be talking about at HTML5 Live

A. Are we there yet? We’ll take an honest look at the state of the art of mobile standards and browser implementations. We discuss what can be built, what has been built – and what to stay tuned for.

Q. What will people who attend your talk learn

A. How HTML5 is changing the way we can develop sites and apps for the mobile platform – and also how it isn’t. What frameworks, tools, techniques and approaches are valuable.

Q. What will they take away that they can apply right away

A. Recommendations, framework suggestions, useful resources & tools. Even code fragments ;-)

Q. In your opinion, why should people attend HTML5 Live

A. Cut through the hype and learn what it can really mean from a practitioners’ point of view.

Q. Why is HTML5 exciting for web developers? Architects?

A. Because it’s a badge that represents many of the innovative & exciting developments in the web right now. Change is good.

Posted in Events, html5, Kaazing | Leave a comment

HTML5 Live 2011 New York: Explore Canvas

Kevin Hoyt from Adobe gave a great talk on canvas in New York at the HTML5 Live conference. The abstract of Kevin’s presentation:

Learn about programming charts and graphs, animations, drawing applications and other early use-cases for the HTML5 canvas element.  Come explore the canvas API including shapes, styles, transformations, compositing, images and animation.  Along the way we’ll explore examples on both the frivolous and more practical sides of the scale.

Posted in Events, html5 | Leave a comment

Push Based Slide Show App by Lucas Jellema

Lucas Jellema, from Amis, decided to look into a number of comet and WebSocket technologies and products. The first one to dive into deeper, was the Kaazing WebSocket Gateway. He posted a detailed technical article on a demo app he built.

Here’s Lucas’ summary of what the app does:

  • through the web client (HTML 5/javaScript), a user can select an image from a list of ’slides’

    Image

  • the selection of the image is communicated to the server (background WebSocket based or alternatively regular AJAX)Comet (Bayeux)/Long Poll style)
  • the server informs all connected clients about the selected image through a pushed message (background WebSocket based or alternatively Comet (Bayeux)/Long Poll style); these clients all synchronize that slide selection
  • a Java (server side) component can also connect to the server and listen in to image selection events as well as publish image selection messages of its own
  • bonus: it may also broadcast ‘new image available’ events to allow the web clients to update the list of images presented to the user

The post walks you through the architecture, the Kaazing gateway configuration steps, the HTML5/JavaScript, as well as the Java client code.

The beauty of a slide show example is that it can be very nicely shown off at conferences and presentations. Look forward to seeing you presenting with this tool at a conference soon, Lucas!

Posted in html5, Kaazing, WebSocket | Leave a comment

Kaazing Platform Keeps Commercial Fleet Vehicles Safe, in the Right Place, and Running Well

Trackmatic is a fleet management company in South Africa, and they just rolled out their new vehicle monitoring and management system using WebSockets and Kaazing.

Trackmatic uses the process of Telemetry to record and analyze vehicle data using proprietary GPRS hardware fitted covertly in each vehicle. Masses of data is processed and analyzed in the context of pre-defined, customized (or user-specific) business rules and logic for decision making based on exceptions in a matter of seconds. The whereabouts of vehicles under management can be monitored, as they move, through Trackmatic’s easy-to-use Web-based vehicle management system of which Kaazing’s WebSocket Gateway forms an integral part. This provides a means of identifying and flagging deviations from the expected as they happen. Delivering real-time analysis and notification is what sets Trackmatic Solutions apart from its competition.

Posted in Kaazing, WebSocket | Leave a comment

WebSocket Overview in French

If you’re looking for a great overview of WebSockets in French, check out Vincent Ferries’ blog post, titled Séminaire didactique: Web et mobile temps réel avec HTML5 et Kaazing.

Vincent discusses a little bit of Web history, the need for real time communication over the Web, HTML5 and its place today, and the game changing WebSockets technology.

And if your French is rusty (or non-existent), google translate is always here to help you out.

Posted in html5, Kaazing, training, WebSocket | Leave a comment

The WebSocket API Reached Candidate Recommendation Level – Call for Implementations

We reached yet another historic mile stone in the life of WebSockets. The WebSocket API is now a Candidate Recommendation.

But what does Candidate Recommendation really mean?

A Candidate Recommendation is a document that W3C believes has been widely reviewed and satisfies the Working Group’s technical requirements. W3C publishes a Candidate Recommendation to gather implementation experience.

And in case you were wondering about the purpose of the Call for Implementations:

At this step, W3C believes the technical report is stable and appropriate for implementation. The technical report may still change based on implementation experience.

WebSockets cannot be stopped from becoming a standard…

Posted in html5, WebSocket | Leave a comment

HTML5 and WebSocket Presentation in German

Kaazing’s own Matthias Wessendorf is busy giving HTML5 WebSockets presentations throughout Germany and Europe. This is the recording of his recent session (in German) at the Java User Group in Duesseldorf.

Matthias covers the following topics in his talk:

  • HTML5 – Overview
  • Real Time Web – Introduction
  • WebSockets – Introduction, Handshake, Client API
  • Remix – WebSocket and other HTML5 APIs

Matthias uses a wealth of live demos and code samples to get the ideas across. If German is your native language, don’t miss this unique opportunity to watch one of the industry’s most prominent engineers present on WebSockets.

And as a bonus, here’s an article from Matthias in German, titled Web Messaging mit WebSockets.

Posted in Events, html5, Kaazing, WebSocket | Leave a comment