dev-center

How it works

Development involves writing the client side application over the client SDK and the server side application using the server side SDK.

The best to get started is to get the sample server and client application running. We will explain the process through the chat server application. Other samples provided (SpaceWarFare, Rummy cards etc.) can also be run in a similar way.

You can follow the steps below – there is also a video which illustrates running of the sample from scratch.

Note AppWarp S2 requires the following to be installed on the server machine.

  • JAVA: JDK 1.7 or above
  • ANT: apache-ant-1.8.3 or above

  1. Get the Chat Server sample from our downloads page.
  2. Unzip and navigate to Chat Server folder.
  3. You can either run the server using the provided script files (OS dependent) or open it as a project in your favorite Java IDE such as Eclipse or Netbeans.
  4. To run using script, ensure the script files are there in the ChatServer folder. You can now run the scripts from the command line or simply double click on them.

Starting the server application

windows

This will launch the server in a new command prompt.

windows_start.bat

linux

linux_start.sh

MacOS (run directly using ANT)

ant -f warp.xml

command line

Launched client

Launched client

To run using Eclipse IDE, do the following steps

  1. File->New->Java Project
  2. Enter project name for example ‘ChatServer’
  3. Finish
  4. Right click the project and import->File System
  5. Import the downloaded ChatServer folder and click OK
  6. Verify that the project is setup correctly and looks something like below
  7. Now add the JAR files in the lib folder to your “build path”
  8. Run the project (select the Main class in the ChatApp when prompted)

eclipse

Similarly, you can do it for NetBeans.

Now you need to create a zone using the dashboard (required only first time)

You can use either the dashboard hosted on our site or download it if you want to host that yourself. To host it yourself, follow the below instructions.

  1. Download the Admin Dashboard.
  2. Copy it to your web server’s directory and start your web server
  3. Navigate to your localhost
  4. Note that the server from the previous step must be running before you open the dashboard.

login

  1. Now enter the username and password as in your AppConfig.json file (default values are matching so just click sign in). The Host value should be the address where your AppWarp S2 server is running. (127.0.0.1 if you are working locally)

main

  1. Now click on the zones tab on the left
  2. Now enter a zone name and click on “Create Zone”

create zone

  1. Note down the AppKey
  2. Now navigate to the Rooms tab and create a new room by entering the same AppKey as in the last step.

room

  1. Note down the room id generated.

Now we are ready to edit and run the client HTML5 application

  1. Open the index.html file in the HTML5ChatClient folder in a text editor
  2. Replace the apiKey var value with the AppKey of the zone you created earlier.
  3. Replace the AppWarpS2Host var value with the address of the server.
  4. Save the file and open it in a HTML5 supported browser like Chrome.
  5. Enter your name and connect.
  6. Now join any of the rooms created earlier (should be visible on the left).
  7. Enter messages and notice how the messages with “profane” text are dropped.

  8. For the Corona client, you need to edit the main.lua file in the Corona client folder as indicated below and replace the values

lua chat

Now run the sample Corona client.

Congratulations! you just ran your first AppWarp S2 application :)

To understand how the server side logic of this app works read the following document

Samples walkthroughs