Cita:
Iniciado por chwc te dejo un ejemplo
Gracias.
Copié y pegué tál cuál.
La página HTML continua 100% en blanco, y no hay errores JS.
La consola retorna esto:
Código:
E:\HTTP\NJS\pruebas>nodemon s2.js
18 May 21:44:16 - [nodemon] v0.7.8
18 May 21:44:16 - [nodemon] to restart at any time, enter `rs`
18 May 21:44:16 - [nodemon] watching: E:\HTTP\NJS\pruebas
18 May 21:44:16 - [nodemon] starting `node s2.js`
info - socket.io started
debug - served static content /socket.io.js
debug - client authorized
info - handshake authorized Vk3H-8Md-WBzKerrrFpN
debug - setting request GET /socket.io/1/websocket/Vk3H-8Md-WBzKerrrFpN
debug - set heartbeat interval for client Vk3H-8Md-WBzKerrrFpN
debug - client authorized for
debug - websocket writing 1::
E:\HTTP\NJS\pruebas\s2.js:5
socket.emit('V',v); // enviamos el valor de v, con el identificador de
^
ReferenceError: socket is not defined
at SocketNamespace.<anonymous> (E:\HTTP\NJS\pruebas\s2.js:5:9)
at SocketNamespace.EventEmitter.emit [as $emit] (events.js:117:20)
at connect (E:\HTTP\NJS\node_modules\socket.io\lib\namespace.js:292:10)
at E:\HTTP\NJS\node_modules\socket.io\lib\namespace.js:308:13
at SocketNamespace.authorize (E:\HTTP\NJS\node_modules\socket.io\lib\namespa
ce.js:252:5)
at SocketNamespace.handlePacket (E:\HTTP\NJS\node_modules\socket.io\lib\name
space.js:302:14)
at Manager.handleClient (E:\HTTP\NJS\node_modules\socket.io\lib\manager.js:6
98:32)
at Manager.handleUpgrade (E:\HTTP\NJS\node_modules\socket.io\lib\manager.js:
618:8)
at Server.<anonymous> (E:\HTTP\NJS\node_modules\socket.io\lib\manager.js:123
:10)
at Server.EventEmitter.emit (events.js:106:17)
18 May 21:44:23 - [nodemon] app crashed - waiting for file changes before starti
ng...
Que será?