Developing TicToe HTML5/Preparing the Server: Difference between revisions

From Arianne
Jump to navigation Jump to search
imported>Hendrik Brummermann
Created page with "<noinclude>{{Navigation TicToe HTML5}}__NOTOC__</noinclude> {{TODO|Write this article, at the moment it contains just some notes}} Now it is time to get a basic (empty) server ..."
 
imported>Hendrik Brummermann
Created page with "<noinclude>{{Navigation TicToe HTML5}}__NOTOC__</noinclude> {{TODO|Write this article, at the moment it contains just some notes}} Now it is time to get a basic (empty) server ..."
(No difference)

Revision as of 01:51, 21 December 2011

Development log of TicToe HTML5

TODO: Write this article, at the moment it contains just some notes

Now it is time to get a basic (empty) server up and running.

server.ini

Marauroa is configured using a server.ini file. It tells the framework, how it can access its database and contains further information about the game. For now, just copy and paste the following code and save it as server.ini in your project root folder.

# Configure database using the serverless H2 engine
database_adapter=marauroa.server.db.adapter.H2DatabaseAdapter
jdbc_url=jdbc:h2:~/tictoe/database/h2db;AUTO_RECONNECT=TRUE;DB_CLOSE_ON_EXIT=FALSE
jdbc_class=org.h2.Driver

# TCP port for traditional clients
tcp_port=32170

# The length of the server game loop in milliseconds
turn_length=300

# Name of our game
server_typeGame=tictoe
server_name=TicToe

HTML5 just use https for secure communications and that is handled by the webserver. But for traditional clients, Marauroa has to do the encryption. Therefore we need to generate a key pair with the command: marauroa.tools.GenerateKeys. It will ask for the key length and then output 3 lines that we append to the server.ini.

# Encryption key
n = 900370704947823124855781868486098993883139326458426419821694524929194085970977109550540519463413920574303896162026330535842004647058075091756193089826466644581
e = 15
d = 120049427326376416647437582464813199184418576861123522642892603323892544796130273271757994671295519024634180073146730306761515863656819847545998907329992154007

Important: Do not use these example keys but create your own pair.

Starting the server

Make sure that marauroa.jar, and its dependencies are on the classpath. Then execute the class marauroa.server.net.web.WebSocketServer.

If all goes well, you will be greeted by some status message. The last one will be:

INFO  [main      ] marauroad                (123 ) - marauroa is up and running... (startup time: 3.1 s)

Testing client/server communication

TODO: Write this section