So I've done a little reading and I just want to verify if this would be the best approach.
My users need to receive data from an external application. They do not need to interact with each other, just simply receive updates from the external application. This external application pushes data out on a TCP socket. I originally used the TCPSocket example ( http://www.ape-project.org/wiki/index.php/TCPSocket) to have my users directly connect to the external app. This seems to work fine, but with clients with slow connections it seems like the connection would disconnect or I would get 004 or 250 errors. I'm now looking at the server.js example bundled in the ape/examples folder. My question is if I want to push data from an external app to my users I will need to do the following: - create a server side module where I would listen to a certain port - create a new application to listen for messages from my external app and connect to the APE server using my server side module - this new application will push the data to the channel all my users are subscribed in Would this be the best approach if my external application is expected to stream a high volume of messages? On Thursday, August 9, 2012 6:24:54 PM UTC+8, Gino wrote: > > I have an application where my clients need to receive data from a server. > It's one way, the clients don't need to send data to the server. > I've used the TCPSocket implementation to have my clients connect to the > server directly. > I followed this example: > http://www.ape-project.org/wiki/index.php/TCPSocket > I edited the socket.onread() event to call a function that updates my page > with the latest data that is pushed to the client. > > Everything works fine but I notice how some clients suddenly stop, and it > seems like their connection is lost. I need to refresh the page for me to > reconnect and have things working back to normal. > I noticed the socket.onclose() doesn't seem to fire when this occurs. I > want to be able to somehow catch when the connection is lost and try to do > a re-connection. > > I did discover that error codes 004 and 250 were popping up in raw data > that was being passed. I tried using the client.onError event for 004 and > 250 but I don't know how to reset the socket. > socket.close() does nothing, and when i try to do a socket.open nothing > happens. > > What's the best way to capture disconnects and reestablish my connection > to ensure a smooth connection for my clients? > I'm also open to hear if there are better ways to implement this for my > use case. Would love to hear from the community. > > Thanks! > -- You received this message because you are subscribed to the Google Groups "APE Project" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/ape-project?hl=en --- APE Project (Ajax Push Engine) Official website : http://www.ape-project.org/ Git Hub : http://github.com/APE-Project/
