class property Server.canServe
Server.canServe → Boolean
Use this property as a feature-check to determine whether or not the
current game engine has the capability to host a Server
. This value,
for instance, is set to false
on the HTML engine, as a web browser is not
capable of starting it's own WebSocket server. On the Java game engine,
this value is true
, as Java has a WebSocket server written for it that
can be used by your game.
var Server = SGF.require("Server");
if (Server.canServe) {
var server = new Server();
server.start();
}