21

I am considering few options for pushing data from server to the client for my web application in real time.

I have implemented a polling based (each client sends http requests to the server after every 30 secs.) application which really doesn't scale up after 10 users are in. This app. is built using MySQL, PHP, HTML and jQuery.

Kindly suggest which one would be better considering the requirements below - APE Vs node.js

  1. Should be able to handle at least 400 concurrent connections at a time
  2. Server should be able to push data to all these clients.
  3. Clients would be sending across data between each other.
Vijay
  • 687
  • 1
  • 4
  • 9

4 Answers4

17

I strongly suggest you to take a look at the Socket.IO. It's a complete solution for server push, that includes both server side library (written in node.js) and client JS library that is made in a cross browser manner. I see no reason for you to implement your own code for doing what is already made, working and tested.

The only case that socket.IO won't handle is your third request, but that is impossible anyway. If I understand you correctly, you would like two clients to communicate without help of third party server? You can't change HTTP into P2P, at least not now.

If on the other hand you meant to communicate two users via your server (doing something like a private two-person chat) that is totally doable using socket.io.

WTK
  • 16,583
  • 6
  • 35
  • 45
  • Thanks! I will checkout Socket.IO, About my 3rd request I meant communication between two users via server. – Vijay Sep 05 '11 at 09:20
  • @Vijay relaying messages with a server as a middle man is possible (and simple) using socket.io – Raynos Sep 05 '11 at 10:06
  • 1
    Using socket.io means that the existing php application has to be rewritten in node.js right? Or a communication channel has to be used between the two (php and node.js) like an MQ or something? – sharat87 Sep 05 '11 at 11:03
  • Yes, existing php logic has to be expressed in node.js, at least the part directly related to server push. – WTK Sep 05 '11 at 11:07
  • Socket.IO looks impressive.Thinking to use it. – kta Jan 20 '15 at 12:50
14

Even though everybody is running towards node.js right now, we did a chat application based on APE and we are very happy with it.

APE provides what you are looking for quite "out of the box" since it is a combination of server side JS and a client framework APE_JSF that provides the functionality (and more) that you get from socket.io.

In this project we handle ~9000 concurrent users with real time messages. An nginx server is put in front of APE to provide deflate/gzip support

This configuration (without nginx as well) will have no problem dealing with your requirements, even on a "not so high end" machine.

Since you can push data to "a channel" or a single user, you should be able to achieve exactly what you are looking for with APE, from broadcasts to direct messages.

Jeremy Mack
  • 4,987
  • 2
  • 25
  • 22
Xosofox
  • 840
  • 1
  • 7
  • 21
  • how did you setup nginx with APE, the way you are describing? – TarunG Dec 20 '12 at 18:00
  • 1
    Here is a working config - I'm quite sure it's not perfect, but it did the job: http://pastebin.com/3Urdy5Fi – Xosofox Dec 21 '12 at 19:59
  • I recommend to replace the official client library by this one: https://github.com/ptejada/ApePubSub I found its API easier and its loading is not messy unlike the official one. – younes0 Jan 28 '13 at 21:44
  • Is APE dead? I wanted to try it out for a project, but their website is pretty useless at the moment... – radix07 Mar 27 '13 at 21:01
  • the project is inactive according to the website and the github account of @paraboul. check the google group : https://groups.google.com/forum/?fromgroups#!forum/ape-project – younes0 May 05 '13 at 21:19
  • APE is still alive, kept online by the community. New website, new wiki, new demos and an active Mailing list - don't dispair – Xosofox May 07 '14 at 18:26
4

If you are using Apache within your existing stack then, as you already said, there will be problems with scaling you users even if you use long polling instead of continuous one. Solution might be to use high performance web server like nginx in order to handle many concurrent connections.

On the other hand node.js is made for this kind of connection concurrency and there are packages, like socket.io, which can make your developer life much easier since it offers various kinds of transport options with fallback solutions and other useful functionality.

yojimbo87
  • 65,684
  • 25
  • 123
  • 131
-1

I wouldnt recommend ape for large scale applications , its just fine for chat applications but as far as mass data transport concerned client's browser starts to slow down and crush after a while.

Alan
  • 1