Note that there are some explanatory texts on larger screens.

plurals
  1. PONode.js and socket.io don't work on Cloud9 IDE
    text
    copied!<p>Does anyone has experience to have Node.js and socket.io working on Cloud9 IDE?</p> <p>The "Example (NodeJS with Socket.io)" (at <a href="https://c9.io/site/blog/2013/05/native-websockets-support/" rel="nofollow">https://c9.io/site/blog/2013/05/native-websockets-support/</a>) doesn't work.</p> <p>First, the server (<a href="https://c9.io/etlolap/webapp" rel="nofollow">https://c9.io/etlolap/webapp</a>, /test.js) throws an error unless I fix as follow. I clicked Run button while test.js is on active tab.</p> <pre><code>var socketIo = require('socket.io'), io = socketIo.listen(Number(process.env.PORT)); io.sockets.on('connection', function (socket) { socket.emit('news', { hello: 'world' }); socket.on('my other event', function (data) { console.log(data); }); }); </code></pre> <p>Then, my client (<a href="https://c9.io/etlolap/webapp" rel="nofollow">https://c9.io/etlolap/webapp</a>, /test.html) still cannot connect. I clicked Preview button while test.html is on active tab.</p> <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;script src="/socket.io/socket.io.js"&gt;&lt;/script&gt; &lt;script&gt; var socket = io.connect('https://webapp-c9-etlolap.c9.io'); socket.on('news', function (data) { console.log(data); socket.emit('my other event', { my: 'data' }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; Loading... &lt;/body&gt; &lt;/html&gt; </code></pre> <p>and got error message below.</p> <blockquote> <p>Failed to load resource: the server responded with a status of 404 --- (Not Found) <a href="https://c9.io/socket.io/socket.io.js" rel="nofollow">https://c9.io/socket.io/socket.io.js</a></p> <p>Uncaught ReferenceError: io is not defined --- test.html:6</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload