http://socket.io/get-started/chat/에있는 Socket.IO의 간단한 예제를 따르려고합니다. 지금까지 내가하는 index.js 파일에 다음 코드를 :Socket.IO 간단한 예제가 작동하지 않습니다.
// INDEX.JS File var app = require('express')(); var http = require('http').Server(app); var io = require('socket.io')(http); app.get('/', function(req, res){ res.sendfile('index.html'); }); io.on('connection', function(socket){ socket.on('chat message', function(msg){ console.log('message: ' + msg); }); }); http.listen(3000, function(){ console.log('listening on *:3000'); });
내가 점점 오전 오류는 다음과 같습니다
WS에 연결 : // localhost를 : 3000/socket.io /? EIO = 2 & transport = websocket & 페이지가로드되는 동안 sid = i0SyiRvHJC1GUiafAAAC가 중단되었습니다.
페이지를 탐색하기 위해 FireFox를 사용하고 있습니다. 또한 Chrome에서는 작동하지 않습니다.
이 문제는 [socket.io 404 not found] (https://stackoverflow.com/questions/48198835/socket-io-404-error/48255983#48255983) –