Arrowbaz Posted January 10, 2015 Share Posted January 10, 2015 Hi ! I'm making a game with JSON file for data, I use node-webkit for distribute the game, but I would like to update data without re-download the app. What's is the best way for the app to communicate with a database, AJAX call, Socket.io, or ? (it's not about which database management systems and system on server, it's how to communicate between the server and the app) How do you make ? Make you one request for update the game, store response in localStorage, or one request each time you need data ? How millisecondes do you have between request and response ? Informations : I can choose your best way for your solution, big data one time, many small requests, or moderate frequency and size requests. Regards,Arrowbaz Quote Link to comment Share on other sites More sharing options...
WombatTurkey Posted January 10, 2015 Share Posted January 10, 2015 Depends. Socket.io for a multiplayer consistent world. Where players positions are being updating frequently (or a chat system), simple ajax for turned based games. You using mysql as storage? Quote Link to comment Share on other sites More sharing options...
Arrowbaz Posted January 10, 2015 Author Share Posted January 10, 2015 Yes I'm still on MySQL. It's not for massive frequency update like player's x,y , it's for example when a player enter in an area, get the "action" he can does here with a select. SELECT action FROM actions WHERE area = player_area and I get response like : { actions: [{ action1: { id: 1, name: "hello" } }, { action2: { id: 2, name: "world" } }]} Quote Link to comment Share on other sites More sharing options...
WombatTurkey Posted January 10, 2015 Share Posted January 10, 2015 You can do simple ajax requests for stuff like that, and you'll be fine.. Use setTimeout, etc for running them in the background. Then use JS to update the pages necessary dependent on what you're calling with JSON. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.