My guess is that you are directly opening your HTML file from the file
system in a browser instead of via a localhost URL. I think you need an
HTTP server that works with Socket.IO and serves your static HTML file. You
can use Express or Strata for that. I can send you an example of setting
that up if you need it.

---
R. Mark Volkmann
Object Computing, Inc.

On Aug 30, 2012, at 6:49 AM, Claudio Alvarado <[email protected]>
wrote:

hi people
I try to use socket.io but I have this error
XMLHttpRequest cannot load
http://localhost:7070/socket.io/1/?t=1346294690161. Origin null is not
allowed by Access-Control-Allow-Origin.

this is my code:

server.js
var io = require('socket.io').listen(7070);


io.sockets.on("connection", function arranque(cliente){
cliente.on("nuevoMensaje", function emitir(dato){
io.sockets.emit("MensajeDesdeServidor", dato );
console.log("mensaje de un cliente" + dato)
});
});


client:

<script src="http://localhost:7070/socket.io/socket.io.js";></script>
$(document).on('ready', function(){
var websocket = new io.connect("http://localhost";, {port: 7070});
//websocket.on("nombreDesdeServidor", function(datoServidor){
// $("#formulario label").text("Acaba de entrar" + datoServidor);
//});
});

if you can help me, thanks

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to