views:

9

answers:

0

We are developing an online real-time web browser game and we have chosen to use APE Server. We have an in-game chat system from our previous project and we would like to port it to APE. As we are a bit new to APE we are not sure about which scenario would work better or maybe would not work at all.

Now the chat works the following way: -the chat has 4 rooms where users talk about some certain game aspect (trade, fight etc.) when user reloads the page completely, he/she gets the latest 30 messages form db (database) for the opened chat room -the chat is issuing periodic AJAX requests to see if there are new messages in any of the chat rooms, but the actual latest messages are downloaded only for the chat room which is currently open. To make things even more complicated, we have separated the chat into separate languages - users get messages only for the language which is in their preferences cookie. They can change it any time and then they'll get messages for the other language.

Now as we are moving to completely AJAX based system without page reloading at all, we will be automatically minimizing the requests to get the latest 30 messages form db.

But the hard part is - how to organize storing the messages in db and sending to the users through APE?

We have considered the following options: - user sends a message to PHP script, it goes to db, then PHP submits the message to the APE through inlinepush (according to docs, inlinepush supports only one channel, we are not sure how it will work then) and then APE is sending the message to all users (it seems, we need to store on the APE server also the user preferred language, so the message gets sent only to appropriate users); - user sends the message to APE Server, and APE server delivers it to the other users of the same language and also calls PHP script to store the message to db; - user sends the message to APE Server, and APE server delivers it to the other users of the same language and stores the message to db using APE's own Mysql abilities.

From the one hand, we prefer to store data through PHP because we have a pretty robust db access library and we would like to avoid porting it to APE and Javascript just to store chat messages (and also we have no experience with server-side JS). But if it will give some good advantages then of course we will use APE's own Mysql.

Also we are worried, will APE be able to filter all users by their language and send the message only to appropriate users? How APE is dealing with cookies?

Also the subdomain-based channels in APE seem a bit awkward to set up, but we haven't found any better alternative yet.