Developing TicToe HTML5/Preparing the Server: Difference between revisions
Content deleted Content added
imported>Hendrik Brummermann No edit summary |
imported>Hendrik Brummermann |
||
Line 52:
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
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> connected</code>
Now we are going to create an account for testing. Please note: The password will be visible since it is just a method parameter. In the finished program there will be an user dialog for the password, with a hidden input field.
* '''<code> marauroa.clientFramework.createAccount("testuser", "password", "test@example.com");</code>'''
** <code> Account "testuser" created successfully.</code>
After logging into that account, the server will send us some information, including a list of all character belonging to our account. The default implementation of marauroa.clientFramework.onAvailableCharacterDetails() is quite smart: It will automatically create a character, if there is none. Furthermore it will automatically pick the first one. This behaviour suites out test just fine, we may redefine it at a later stage, through.
* '''<code> marauroa.clientFramework.login("testuser", "password");</code>'''
** <code> Previous Logins []</code>
Line 64 ⟶ 72:
** <code> Character "testuser" created successfully.</code>
** <code> onAvailableCharacterDetails: Object { testuser={...}}</code>
** <code> Entering world</code>
If all goes well, the last message will be "Entering world". The world is obviously empty at this stage. The next chapter will go into details on how to define the content of the world on the server.
| |||