How to make works on

I have discovered this amazing site it allows you to code online and deploy your projet on another server.
You can get your source from a github if you want too.

I wanted to make a little concept and looked at documentation here:

But their code doesn’t work so I have done my own example based on official documentation

Don’t forget to install choose nodejs project when you create one on and after use « $ npm install » to install

First create a file called server.js and put this code on:

var app = require(‘http’).createServer(handler)
, io = require(‘’).listen(app)
, fs = require(‘fs’)


function handler (req, res) {
fs.readFile(__dirname + ‘/index.html’,
function (err, data) {
if (err) {
return res.end(‘Error loading index.html’);


io.sockets.on(‘connection’, function (socket) {
socket.emit(‘news’, { hello: ‘world’ });
socket.on(‘my other event’, function (data) {

———————- > to launch the file type in your console node server.js

you should have:
bash-4.1$ node server.js
info – started

And now create a file called index.html and put this code on: (same as c9 example)

var socket = io.connect(‘′);
socket.on(‘news’, function (data) {
socket.emit(‘my other event’, { my: ‘data’ });

———————> launch your url (ex:

and you should see in your console debug – served static content /

Hope it helps.