SFS2X Docs / GettingStarted / web-sockets
» Using HTML5 and WebSockets
Starting at version 2.3.0 SmartFoxServer 2X provides support for HTML5 via WebSockets. If you are unfamiliar with this technology, WebSockets is a W3C standard for socket communication via native HTML5 applications, written in JavaScript. In conjunction with the latest web-browser technologies such as Canvas and WebGL this opens interesting opportunities to create sophisticated online games that don't require any specific browser plug-in.
» Preamble
WebSocket is an evolving project that is part of the new HTML5 set of standards for web communication. Since the specifications for this new protocol are still in the works, please consider our API to be in a Release Candidate state until a final draft is approved by the W3C committee.
From a purely client side perspective any application written for HTML5/WebSocket can be ported on any platform that runs an HTML5 compliant browser (e.g. computers with different OS, tablets and smartphones).
» Supported API features
The HTML5/JavaScript API provided with SmartFoxServer 2X covers all the standard API features, although some low level characteristics are not available. Below is a list of what is not supported or will be added later.
- Binary protocol: due to the high level of abstraction of the JavaScript language it is currently not possible to manipulate data at the byte level. The current HTML5 API employs JSON serialization, offering an efficient way to encode SFS2X objects.
- BlueBox: the firewall-traversal system is not available for HTML5 clients. In order to maximize the client connectivity it is advisable to configure the WebSocket engine to run on HTTP ports such as 80, 443 or 8080.
- HRC: the SFS2X reconnection system is currently not supported by HTML5 clients.
» Supported browsers
At the moment of writing this article (September 2012) we know that the following browsers support HTML5 and WebSockets correctly:
- Google Chrome
- Mozilla Firefox (including mobile versions)
- Apple Safari (version 6, including mobile version)
- Microsoft Internet Explorer 10
All the other internet browsers not mentioned here are likely to have partial or no support for WebSockets and therefore they won't work correctly.
» Documentation
In order to setup and use the HTML5/JavaScript API, please refer to the instructions on the Client API setup page.
Detailed jsDoc is also available here: the API classes and their methods/properties are fully described, together with usage examples.



