<!-- this is the html page with the client program running for my cloud 9 websocket server --> <html><body> <div id="displayReceived"></div> <button type="button" onclick="sendMessage('hello there, server');">Send Message</button> </body></html> <script src="https://cdn.socket.io/socket.io-1.4.5.js"></script> <script id="clientProgram"> var socket = io.connect('https://cloud9-python-ds604.c9users.io/'); socket.on('msgFromServer', processMessage); function processMessage(data){ console.log(data); document.getElementById('displayReceived').innerText += data + '\n'; } function sendMessage(data){ socket.emit('msgFromWebsite', data); } </script> <!-- and this is the node js server program that i want to paste into cloud 9 ide and start running to respond to my websocket requests from the web page--> <xmp id="serverProgram"> var express = require('express'); var app = express(); var server = app.listen(process.env.PORT); console.log("My socket server is running."); var socket = require('socket.io'); var io = socket(server); io.sockets.on('connection', function(socket){ console.log('new connection: ' + socket.id); console.log(socket.id); socket.on('msgFromWebsite', function(msg){ console.log('Received from website: ' + msg); console.log('Sending a thank you card...'); io.sockets.emit('msgFromServer', 'thanks for the message, website!'); //socket.broadcast.emit('msgFromServer', 'thanks for the message, website!'); }); });