1
votes

Getting continuously http://localhost:8890/socket.io/?EIO=3&transport=polling&t=1525342978802-2 get requests

Client : socket = io.connect('http://localhost:8890')

Server: var app = require('express')();

var server = require('http').Server(app);

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

io.on('connection', function (socket) {

console.log(socket['id'] + "  client connected");

});

Any help highly appreciated. Thanks in advance.

1

1 Answers

1
votes

Asuming you are getting a 404 error from these calls, 2 things:

  1. Have you imported socket.io on client?

<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.4/socket.io.js"></script>

or just

<script src="/socket.io/socket.io.js"></script>

  1. Have you run npm install after adding express and socket.io references on package.json?

Can you write the full code (client at least)?