Or more simple: server:
app.js var http = require('http'); var fs = require('fs'); var server = http.createServer( function(req, res) { fs.readFile('./index.html', function(error, data) { res.writeHead(200, { 'Content-Type': 'text/html' }); res.end(data, 'utf-8'); }); }).listen(3000); var io = require('socket.io').listen(server); io.sockets.on('connection', function(socket) { socket.emit('mensaje', { text: 'hola' }); }); index.html <script src="/socket.io/socket.io.js"></script> <script> var socket = io.connect(); socket.on('mensaje', function(data) { alert(data.text); }); </script> run: node app.js firefoxOS: http://xx.xx.xx.xx:3000 2014-08-19 12:25 GMT+02:00 jbc <jav...@gmail.com>: > http://socket.io/demos/chat/ > > > 2014-08-19 8:53 GMT+02:00 Salvador de la Puente González < > salvador.delapuentegonza...@telefonica.com>: > > On 19/08/14 02:17, jbc wrote: >> >> Hello. >> I tested socket.io in firefoxOS 1.3 on GP Keon. >> >> Can you elaborate? Paste the code, explain what is not working... >> >> But. socket.io doesn't work. >> Thank you. >> >> Cheers! >> >> >> >> _______________________________________________ >> dev-b2g mailing >> listdev-b2g@lists.mozilla.orghttps://lists.mozilla.org/listinfo/dev-b2g >> >> >> >> ------------------------------ >> >> Este mensaje y sus adjuntos se dirigen exclusivamente a su destinatario, >> puede contener información privilegiada o confidencial y es para uso >> exclusivo de la persona o entidad de destino. Si no es usted. el >> destinatario indicado, queda notificado de que la lectura, utilización, >> divulgación y/o copia sin autorización puede estar prohibida en virtud de >> la legislación vigente. Si ha recibido este mensaje por error, le rogamos >> que nos lo comunique inmediatamente por esta misma vía y proceda a su >> destrucción. >> >> The information contained in this transmission is privileged and >> confidential information intended only for the use of the individual or >> entity named above. If the reader of this message is not the intended >> recipient, you are hereby notified that any dissemination, distribution or >> copying of this communication is strictly prohibited. If you have received >> this transmission in error, do not read it. Please immediately reply to the >> sender that you have received this communication in error and then delete >> it. >> >> Esta mensagem e seus anexos se dirigem exclusivamente ao seu >> destinatário, pode conter informação privilegiada ou confidencial e é para >> uso exclusivo da pessoa ou entidade de destino. Se não é vossa senhoria o >> destinatário indicado, fica notificado de que a leitura, utilização, >> divulgação e/ou cópia sem autorização pode estar proibida em virtude da >> legislação vigente. Se recebeu esta mensagem por erro, rogamos-lhe que nos >> o comunique imediatamente por esta mesma via e proceda a sua destruição >> > >
_______________________________________________ dev-b2g mailing list dev-b2g@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-b2g