Comet Chat in GoDaddy Linux Dedicated Server? - comet

I want to know if it's possible to make my own chat application with ajax push.
And if it's, what is the easiest way to do it?
I know how to use javascript and make ajax calls but that's as far as I go. I can find tutorials myself but I can't tell whether the method is good or not so any links will be appreciated.
Thanks

to use ajax push (comet), you must make a server that will keep concurrent connections.
You can really do anything look for echo servers in your favorite language. Java/C/C++.. I'd do this in Java since it can run on Linux as well.
You can use http://www.ape-project.org/ which seems to be done already all for you.. but seems complex.. I'd recommend starting from scratch with a echo server.

I would recommend using Node.js as it is great at Comet/Ajax-push. Why is it great? Comet applications tend to be event driven and Node.js/javascript excels at these kinds of things.
However, if you prefer to do it in Java, Tomcat actually supports Comet as long as your servlet implements CometProcessor and you use NIO as your http connector. See http://tomcat.apache.org/tomcat-6.0-doc/aio.html

Related

application design: Scala + HTML5

I'd like to implement an application with Scala and HTML5. My idea was to create a "local" client-server architecture: Scala handles the calculations and generates HTML5 as a GUI.
To my mind there are two possibilities
Use a Java/Scala framework that allows embedded HTML5. SWT for example has a browser widget. JavaFX seems good, too.
Distribute the program with a server and run it in a browser on localhost.
It would probably be most convenient to require an internet connection and forget about the localhost. Unfortunately an offline mode is necessary.
Now I would like to know how to get this right:
The first option seems easier to implement but I wonder: How can I communicate with Javascript without the HTTP protocol ?
The second approach was just an idea. Have you ever done something like this ?
If you've got advice or know a good framework please go ahead.
UPDATE :
I've just had an interesting idea: Could I use nodejs to create something like a server-server architecture ?
Right now the communication between Scala and Coffescript seems like the most problematic part. I still wonder how I could initiate an update from the Scala side of the application. A HTTP Request is a nice way to exchange data. Sadly to my knowledge in "standard" Coffeescript there would be no event hook to listen to server-side HTTP messages.
I've thought about using nodejs to listen to the server-sent data. Is this a good idea ?
With regards to the second option, you may wish to investigate the Play! Framework or Lift. They automate a lot of the work required to make a web application in Scala, including handling AJAX requests.
Although I haven't tried packaging either for local use, there was an earlier Stack Exchange question about packaging Lift which might be relevant. It should be possible with Play! as well.

WebSocket server list

I am looking to start a HTML5 WebSockets project and I was just wondering what you think the best back-end would be for that sort of thing? So far in my research I've stumbled across the following:
PHP Back-end (apparently a "Hack" and only compatible with Chrome and webkit nightlies)
Java Back-end (Seems well documented and cross-browser compatible)
Ruby Back-end (Don't know much about ruby, any opinions?)
JavaScript Library (Seems like it would be a nightmare, any opinions?)
Does anyone know of any other options or have an opinion on the above? My only requirements are ease of set-up and easy back end programmibility for bidirectional communication. I would essentially like to access a database through WebSockets and am looking for the easiest way to do this. Any feedback would be appreciated.
Ease of setup would have to be a hosted solution which uses WebSockets, HTTP Streaming or HTTP Long-Polling (one of which I work for). They're the easiest option because you don't need to spend time installing your solution, configuring it and working out how to use in when developing and in production.
If you are looking for a self hosted solution then it really depends on what technology you'd prefer to use and what the community for that technology is like.
Node.js and socket.io has a big community following at the moment so it wouldn't be a bad choice.
PHP - I'm afraid that PHP isn't really build with long-held persistent connections in mind. So, although there are options it's probably best to either use a hosted service or steer clear.
Ruby - check out Faye (also has node.js option), Juggernaut or Cramp
Java: As you say, jwebsocket or WaterSpout Server
Hope this helps.
I 'd recommend websocketd
http://websocketd.com/
It 's a thin layer you can wrap around any program that reads from stdin and writes to stdout and transform it to a websocket server.
So you can write in any language you like. Afterwards just
$ websocketd --port=8080 my-program
and you have your server.

Rails or node.js for Restful API

I have an existing website written in ASP.net, I have recently switched to Mac full time (With Windows in Boot Camp), and need to write a public API for accessing my website's MySQL data. I primarily want to use the API to allow building an iOS application.
I am interested in learning either Ruby on Rails or Node.js, I haven't used either of them yet.
Which language would be better for me to learn?
Rails is a relatively mature web framework based in Ruby and is designed for handling object-mapped data persistence in a relational database backend.
Node.js is much newer on the scene, and unlike Rails, is a more bare-bones package that allows for server-side Javascript applications thanks to a pretty tight HTTP(S) API. Node applications are by nature event-driven, which may or may not be ideal for your application.
Since it seems that you'll need data-persistence (you mentioned accessing MySQL data...), Rails might be easier to get started with, as it comes packaged with all the things you need in this respect and is designed to facilitate this sort of application.
If you you don't really need relational data persistence, Node is probably a better bet as it stays out of your way and lets you decide how to handle things. It's important to note that Node is a much more bare-bones "framework" than Rails -- if you want something slightly higher-level but still lighter than Rails that runs on Node, express is good place to start.
Still, if you want to try Node (I will confess: it's a lot of fun!), it's totally possible to access MySQL in a nice, event-driven (non-blocking) way. Here are two modules that will be helpful:
node-dbslayer
node-mysql
Neither is a language; they're frameworks. There is no "better", there may be a "more suitable" (probably not in this case).
Which would you prefer to develop in, Ruby (Rails), or JavaScript (node.js)?
Would you like to transfer that knowledge to a different job without rampup time (Rails)?
Would you like to learn something a bit more esoteric, event-driven (node.js)? (Ruby has Event Machine, but IMO node.js takes it a bit further.)
So this new application is just a middle man between your ASP.NET thing and your other clients.
In that case, totally use node. Node is great at being networking glue. Node scales great with IO bound applications (i.e. being a network middleman).
If you're going to use node then you probably want to look at express to make it easier.

socket.io and .Net socket server

Excuse me if the question sounds silly but I have to ask. Is there a server side alternative to Node.js written in C#? I need a client framework to fully utilize Web Sockets but AFAIK IE doesn't support Web Sockets and nor will it support in it's next version. socket.io uses Web Sockets if available and falls back to BOSH if not. So I will try to connect to a socket server that is running on .Net Framework.
What are my alternatives?
Excuse me for raising this thread from the dead - my friend and I just posted a server-side websocket server for C#: https://github.com/Olivine-Labs/Alchemy-Websockets
It's fast, it's scalable, and doesn't do everything socket.io does, on purpose: it provides websockets and a flash fallback, which keeps it very lean and efficient. I see you've already done your own stuff, but check it out; and hopefully it'll help others on SO.
Might be an answer to an old question, but I'll write here in case other finds this question using a search engine. Have a look at SignalR (http://signalr.net/) for that abstraction. For a nice post on what SignalR is please read Scott Hanselman's post http://www.hanselman.com/blog/AsynchronousScalableWebApplicationsWithRealtimePersistentLongrunningConnectionsWithSignalR.aspx.

Getting started with web sockets

I'm very interested in learning about the new feature in HTML5 called web sockets. I've looked into it and have come out with a few questions.
It seems that before I can start implementing this new technology into a web application of mine I need to have a web server which supports it. Does this involve downloading something and installing it on the said server? Is there more than one available? If so where do I find these?
I already have experience with JavaScript and HTML/CSS of course, Are there any other languages I will need to learn to start using web sockets?
You might like this:
[Edit this link is outdate]
https://stackoverflow.com/questions/1252829/what-browsers-support-html-5-websocket
http://www.w3.org/TR/2009/WD-websockets-20091029
http://www.websockets.org/about.html