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
 
(12 intermediate revisions by the same user not shown)
Line 52: Line 52:
To test the setup, we open a web browser at <nowiki>http://localhost:8080/index.html</nowiki>.
To test the setup, we open a web browser at <nowiki>http://localhost:8080/index.html</nowiki>.


This will just result in a green screen, but we can manually connect to the server by using the Firebug console:
This will just result in a green screen, but we can manually connect to the server by using the Firebug console. There is an input field at the bottom, that allows you to call any defined method and to inspect any object.

First of all, we need to connect to the server. Type this command and wait for the message "connected" in the console log:


* '''<code> marauroa.clientFramework.connect(null, null);</code>'''
* '''<code> marauroa.clientFramework.connect(null, null);</code>'''
** <code> connected</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>


While it is possible to execute more methods here, this is not useful because we have not implemented any server code, yet.
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.