Examples (iOS)
Examples (Android)

 

» The BlueBox 2X

The BlueBox is an HTTP-based technology that allow clients to connect from behind firewalls and proxies, when a socket connection is not available. This is a typical scenario for corporate offices, schools and other institutions where the network traffic is limited to a few selected services.

The BlueBox enables players under restricted network configurations to play and enjoy fast multiplayer apps and games with little to no noticeable performance loss. All SmartFoxServer applications can take advantage of the BlueBox without any code change.

Behind the scenes the BlueBox uses a so-called HTTP tunnel by wrapping the SmartFoxServer protocol into HTTP packets. The behavior of the BlueBox is pretty different from regular HTTP-polling solutions. The major disadvantages of a regular polling is the continuous traffic of requests coming from the clients, even during inactivity. Additionally the overall performance isn't very good especially if the polling interval is bigger than a couple of seconds.

The BlueBox uses a more sophisticated approach that eliminates the need for continuous polling. Additionally the client API provide the developer with the ability to fine tune the server response times, allowing near real-time performance!

» What's new in BlueBox 2X

The BlueBox 2X code was largely rewritten to provide a tighter integration with the new SFS2X engine (codename BitSwarm). Although the BlueBox 2X features are very similar to its predecessor, its architecture is much lighter and the performance increase is significantly improved.
The main difference in SFS2X is that the BlueBox plugs into the server engine directly, without the need to emulate a socket connection for each client (as in SFS 1.x). This in turn saves lots of resources and allows for better scalability of HTTP connections.

» How to use the BlueBox

Starting from SFS2X RC2 the BlueBox is active by default in the server and doesn't require any particular setup. At any time a client that fails to establish a socket connection can attempt to use the BlueBox.

The only settings you need are located on the client side, in the external client config file.

<SmartFoxConfig>
	<!-- Mandatory Settings -->
	<ip>192.168.0.16</ip>
	<port>9932</port>
	<zone>Bench</zone>
	<!-- End Mandatory Settings -->
	
	<debug>true</debug>
	
	<httpPort>8080</httpPort>
	<useBlueBox>true</useBlueBox>
	<blueBoxPollingRate>500</blueBoxPollingRate>
	
</SmartFoxConfig>

The last three settings that you see are specific for the BlueBox:

» Recommended settings

By default SFS2X uses the following ports:

In order to provide the best connectivity options to your clients you should use TCP ports that are usually not filtered by firewalls. Our recommendation is to use ports 80 (HTTP) and 443 (HTTPS) where possible (e.g. if there isn't another http server in the machine already running).

If you are under Unix/Linux/MacOSX this will require that the server runs with root privileges.

» Monitoring the BlueBox

The connections handled by the BlueBox maintain a special session used by the enclosing HTTP protocol. You can monitor these sessions from the AdminTool by launching the BlueBox Monitor module.

Additionally the BlueBox process logs specific usage data under the SFS2X/logs/bluebox/ folder.