1
\$\begingroup\$

I am creating a multiplayer game using Photon Cloud (Photon Unity Network). For storage of player data (profile, inventory, achievments) I use web server (asp.net mvc & sql server). How to organize the communication between the game client and the web server? I see two ways:

  1. Use WWW class and send requests direct to web server:

    var www = new WWW("http://mygame.com/api/user.get?id=1");
    // Each time creates a new connection to the web server
    
  2. Use Photon Cloud Webhooks and send requests through Photon servers:

    PhotonNetwork.WebRpc("user.get?id=1");
    // Photon Servers play a Proxy or Relay role between client and web server
    

    http://doc.photonengine.com/en/realtime/current/reference/webrpc

Which way do you recommend? The first way is simple but each time creates a new connection to the web server. The second way use one persistent connection between client and Photon server but there is a delay between connecting the Photon server to the web server.

\$\endgroup\$
0
\$\begingroup\$

You can find a list of advantages of the use of Photon's WebRPCs (compared to direct client to web server HTTP requests) at this link.

I think that if you don't need any of those then you shouldn't use it and you can find better alternatives than Unity's WWW.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.