I followed the Jeffrey tutorial.
https://laracasts.com/series/real-time-laravel-with-socket-io/episodes/1
this is my index.js
var app = require('express')(); var server = require('http').Server(app); var io = require('socket.io')(server); server.listen(3000); app.get('/', function(request, response){ response.sendFile(__dirname+'/index.html'); }); io.on('connection', function(socket){ console.log('A connection is made'); });
Some people say their version and year. The code above works in 2014, I think.
This is my html:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"></meta> <title>Chat Lesson</title> </head> <body> <h1>Hello world!</h1> <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.4/socket.io.js"></script> <script type="text/javascript"> var socket = io(); </script> </body> </html>
I have done a lot of research. Some people say consistency is important, but I have found so much consistency.
My mistake:
GET http://chat-lesson.local:8888/socket.io/?EIO=3&transport=polling&t=1515636281477-74 404 (Not Found)
My question is:
Why is he not found? I followed Jeffrey's study guide at every turn, and the textbook was only as short as 5-8 minutes.
I tried using server.listen(8888);
events.js:160 throw er; // Unhandled 'error' event ^ Error: listen EADDRINUSE :::8888 at Object.exports._errnoException (util.js:1022:11) at exports._exceptionWithHostPort (util.js:1045:20) at Server._listen2 (net.js:1259:14) at listen (net.js:1295:10) at Server.listen (net.js:1391:5) at Object.<anonymous> (/Users/kendantinio/Documents/Freelancer/blvnp/chat-lesson/index.js:5:8) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12)
ichimaru
source share