Online Book Reader

Home Category

HTML5 Canvas [223]

By Root 6572 0
--disable-web-security

NOTE

Obviously this is not a workable solution for a production application. As Electrotank (and other companies who make similar products) continue to improve the functionality of their APIs and add support for HTML5 WebSockets, this limitation should disappear.

The best way to test a multiplayer application on your own development machine is to open two web browsers, or two web browser windows, at the same time. When you look at CH11EX2.html in Google Chrome using this method, you should see something that looks like Figure 11-5.

Figure 11-5. ElectroServer chat demo on the canvas with JavaScript API

The full source code is listed in Example 11-2.

Example 11-2. ES5 chat demo

CH11EX2: ES5 Chat Demo