What javascript engine should i use?

i m going to create a dating web site. it’s online game. there are will at first registration, chat and the game, where people can ask question and random users (3 boys to 3 girls) answer on each other at real time.

like on screen (russian flash app). ask question: http://cossa.ru/upload/medialibrary/2f0/Clearasil-2.jpg

answering: http://vkdiz.ru/uploads/posts/2011-08/1314303812_25.0823.png

at the end, people, if they want, they can choose a man: http://onlain-love.ru/wp-content/uploads/2012/08/prilozhenie-v-kontakte-sprosil-uvidel-polyubil.png

so, i know very good html, php, mysql. A little js, ajax, jQuery. what engine and how should i start to make this project?

for example, i read about Ajax Push Engine. Should i use it or search something else, another technology? Or maybe just write site on clear jQuery and mysql?

thank you! :slight_smile:

I’ve recently hacked together a few things (including a basic chatroom) that use a NodeJS server to act as a [URL=“http://www.websocket.org/”]WebSocket server with [URL=“http://socket.io/”]Socket.IO

With the Socket.IO approach you could either run your site on Node or have a separate Node server that runs Socket.IO to act as a server to communicate to.

You can of course get a WebSocket endpoint in PHP as well, then use a plugin/script that provides you with some graceful degradation in case the browser doesn’t support WebSockets.

Thank you for answer.

Yes, some people recommended me use NodeJS. I read that I have to create my server to make chat, for example. I don’t understand, how will it work in Internet, not my local machine? Do i have always turn on my computer in order to stay turned on server? Where users info and messages will be situated? in mysql?

In jQuery it’s easy: no server and js+php scripts to go with mysql.
Why should create server if i can just easy use jQuery+php+mysql?

By the way, I don’t want to be depended on someone to have a separate Node server that runs Socket.IO to act as a server to communicate to.

NodeJS is great for real-time applications like chat/social network type things/interaction etc. At the moment the thing to do seems to get your Node applications hosted in the cloud by places like NodeJitsu or Heroku. Message can be stored in whatever database you want to connect to that you can find a driver for in Node (MongoDB and other NoSQL databases might be a good way to go for things like that)

You don’t necessarily need to create a server, just a PHP script that acts as what effectively is a message relay. A place to send/receive communications from. The “Socket Server” is merely a way to implement what you want to do, the “Socket Server” itself would actually just be a PHP script on your website that you utilize.

In that case, the only way to do it would be to either run your own Node server or to write it in PHP. From the sounds of it, PHP might be the way to go for you as you indicated that you have experience in it :slight_smile:

AussieJohn, thanks a lot, you wrote very well!

Frankly speaking, I don’t want to be depended on someone. If so, do i have to turn my computer always on to make server/site work every minute?

Again, dependency. Where can i also store messages?

IMPORTANT question: in this case i have to set timer (for example, every 3 seconds) in jQuery to check whether someone wrote a message to chat, right? But if i have 10000+ users at one moment, will it work fine? no crashes?

thank you

You’re welcome :slight_smile:

Normally, unless you are running a fast connection at home and are willing to set up a machine to be a dedicated server at home, the thing to do is to get your site hosted. There are many excellent places where you can get your site hosted externally who would be able to offer a fast connection, high uptime and depending on your need, the ability to scale.

You can run a local MySQL server, or if you get your site hosted, many hosts will have things like MySQL, PostgreSQL etc.

Well, that depends on the methodology that you are using. There are several libraries out there that will help you use the most advanced technology (WebSockets) to the older technologies (Comet, Long-Polling with AJAX) by detecting what the browser can support.

If you had 10,000 concurrent users, hopefully by that point you have a very robust framework and a good server in place. 10,000 concurrent users is a pretty high amount, and unless you are realistically expecting this, it’s not worth trying to optimize for this straight away. (But worth keeping in mind for the future if you’re expecting to grow to this!)

If the online chatting is a very important part of your site, one of the other solutions is to use a 3rd party chat client like ChatSpace or an [URL=“https://www.google.com.au/search?q=irc+server+software”]IRC server - you can host those server components yourself (or have them hosted) and connect a client to them, there are a bunch of [URL=“http://www.vedetta.com/ajax-irc-clients-list”]web-based IRC clients that you could use for that.

Thank you again :smiley:

Is there chance that Mongodb server/site/hosting will be crashed and all users that use this database will stop running their sites? Can i backup Mongodb database to my computer (.txt file for instance) and then transfer it to Nosql or my local Mysql server in this case?

By the way, i m going to create large project/site, popular.
Will Mongodb developers able to get my database and use it in thier aims? for example, database with logins and pass.

That depends on where you host your MongoDB - if you host it on your own server, or on a hosted shared/dedicated server you shouldn’t have to worry about that any more than if you were running any other kind of database. If you’re opting for a cloud hosted MongoDB then there are different risks, but cloud hosted solutions to tend to have relatively good failovers. Again, you probably have the same level of risk as you would with any other cloud database provider.

MongoDB is a BSON (Binary JSON) based database, so while you probably can’t directly import data from backups, it would be pretty easy to quickly write a script that does so.

You can put pretty much whatever data you want in to MongoDB - the only thing you need to keep in mind is that MongoDB is excellent at storing stuff and finding stuff relatively quickly, but it is not a relational database. So if you need highly relational data, it would be better to use MySQL for example.

Again, I would still recommend that you don’t reinvent the wheel when it comes to writing a chatserver, there are 3rd party solution out there, both commercial and open source, that you can host on your own server and will do a great job of providing that part of the service.

AussieJohn, i have some short questions again :confused:

  1. why are there hostings for Mongodb (MongoHQ, MongoLab, …), if it is easier and free to install Mongodb on my local machine? or is it for people, who create nodejs server not on his computer, but on NodeJitsu or Heroku, for example?

  2. Can i create my nodejs server not on NodeJitsu or Heroku, but on my hosting? I have account on bluehost.com

  3. I have read that not many hostings user Mongodb. So, can i install Mongodb by myself on hosting (bluehost) and connect my future site to it? or i should install Mongodb on my computer to get faster speed?

I just don’t know who to operate my site. I think i should create nodejs server and install Mongodb on my computer both.

  1. If i create popular site, is it true that i will have buy another computer to make fast connection, site?

thank you

  1. You can choose where you want to host your database, I would recommend a cloud based service over your own computer. By all means install and develop locally, but deploy and use a cloud based one for production services

  2. You’ll have to check with bluehost, but I doubt they will offer support.

  3. It’s more likely that bluehost also won’t support MongoDB, see answer (1)

  4. Only if you host from home, again this isn’t something I recommend. It is far easier to use a hosted solution. Some of the main reasons for this include: Stability, speed, security and scalability, hosting companies spend a lot of time and money to make sure that you have all 4 of those things, something that is far harder to set up and manage on a home computer. Having said that, you can host from home, but if you do that, you should probably do some research on how best to set up a home webserver.

Finally, keep in mind that NodeJS might not be the right solution for you, you might be better of using a PHP based site seeing as you have more experience with that.

AussieJohn, do you know something about Meteor? a new platform for apps. Does this platform suite better for my aims? (Register users, online game, mongodb…)

or SocketStream http://www.socketstream.org/ or Derby http://derbyjs.com/

I haven’t heard much about or used any of these frameworks, my suggestion to you would be:

  • To work out what features your website needs
  • Then work out what the technical requirements of those features are
  • You can then look at all these frameworks and see which one would be the best suited based on its capabilities and how easy it would be to add custom functionality layered on top.