Search code examples
javascriptioscordovamultiplayer

PhoneGap Online Game


I am creating an app using cordova/phonegap 3.4.0 and am trying to implement a multiplayer game mode. The app is a score game where the person with the highest score wins. I have already created the game and need a way to do the following:

- Check when both people are connected
- Send the final score to each device (eg. Device A = 42 and Device B = 39 - Send them to each         
other to compare scores)
- Recieve the other players score to determine who the winner is. 

This can be in either a phonegap plugin format or a javascript file.

Does anyone have any idea's on how I could achieve this. I have tried to find a phonegap plugin without success.

Thank's for everyone's help in advance.


Solution

  • Read about WebSockets API, also you need to read about how to create a WebSocket server, then you need to read about NodeJS, or your preferred server language, (PHP, Java, Python, etc)

    The WebSockets Api was introduced in iOS 6 check the following link for reference http://caniuse.com/websockets , there will be no problem using Phonegap.