Developing TicToe HTML5/Preparing the Server: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
imported>Hendrik Brummermann
No edit summary
imported>Hendrik Brummermann
No edit summary
Line 15: Line 15:
# TCP port for traditional clients
# TCP port for traditional clients
tcp_port=32170
tcp_port=32170

# Web port
http_port=8080


# The length of the server game loop in milliseconds
# The length of the server game loop in milliseconds
Line 47: Line 50:
== Testing client/server communication ==
== Testing client/server communication ==


To test the setup, we open a web browser at <nowiki>http://localhost:8080/index.html</nowiki>.
{{TODO|Write this section }}

This will just result in a green screen, but we can manually connect to the server by using the Firebug console:

* '''<code> marauroa.clientFramework.connect(null, null);</code>'''
** <code> connected</code>
* '''<code> marauroa.clientFramework.createAccount("testuser", "password", "test@example.com");</code>'''
** <code> Account "testuser" created successfully.</code>
* '''<code> marauroa.clientFramework.login("testuser", "password");</code>'''
** <code> Previous Logins []</code>
** <code> ServerInfo ["tictoe", "TicToe"]</code>
** <code> onAvailableCharacterDetails: Object {}</code>
** <code> Character "testuser" created successfully.</code>
** <code> onAvailableCharacterDetails: Object { testuser={...}}</code>

These three commands will connect to the server, create a new account "testuser" and login. There is a default handler for the onAvailableCharacterDetails event, that will automatically create a character, if the account does not have any.