Sorry for the rather ignorant question, but I’m a bit confused regarding these two technologies. I wrote a webserver in C# that uses Fleck and everything works great but I realized I probably couldn’t find a hosting provider that would run .NET applications.
I want to use websockets and I found socket.io to be really popular but I’m not sure exactly what it is. Correct me if I’m wrong, but, is it just like writing a server in javascript and you run the javascript file with the node.exe application and then the server is running? How do people find hosting providers that will provide that sort of service?
Lastly, is socket.io just an extension of nodejs? Do you have to code your server in javascript when you use socket.io? Again, sorry for the very novice questions but I’m just trying to understand a few basic things before I continue. Thanks.
There are a few companies that will host your node application. Its not the same as your transitional web hosts where you provide them with files and they serve the files for you. When working with node you’re writing the actual web server.
Some of the popular ones around are below:
When working with a virtual server you have full rain over what your running on the server.
Pros
Freedom, you get to pick all the software you want to run on your machine. A lot of the times when working with nodejs you’re going to want some custom software to be running along side your application. Most of the time this is your database layer, which ever you choose.
Cons
YOU have to maintain it. Like @Roest stated, this isn’t much of a con for most people as this ties directly into the freedom a virtual server gives you but it is something you need to take into account.
I think the reason you see limited support for nodejs is because its relatively new, and its so easy to setup yourself.
That’s pretty much exactly what nodejs is, or at least how you use it. Nodejs itself is Google’s V8 javascript engine running on your server, along with a large number of libraries and C bindings that allow you to interact with your server in a way that the V8 engine won’t let you.
This is an example of a webserver in nodejs (A very limited one)
It just responses
Hello Worldto every request and always returns a 200 status code.Going from something like this to a simple file server is fairly easy and quick, but a few people have already tackled this problem for you.
http://expressjs.com/ – Very powerful web server, but still gives you a lot of freedoms.
https://github.com/nodeapps/http-server – Simple web server, I use it mainly as a command line tool to instantly server files over http.
socket.io among many others is a module of nodejs. Depending on your definition of extension it may be the wrong word to use. Most of the time when using socket.io you’r going to be using an existing http server and then extending, or wrapping your server with socket.io. I wrote a previous explanation of how nowjs does this. My guess is socket.io is very similar.
To answer the bulk of that question: Yes, you will still be writing your code in javascript. You will just be utilizing the socket.io API.