I'm using socket.io and socket.io-client on the Express and React sides, respectively.
On the server side, I console.log in the connection event with the socket.id, and it always displays two connections when I only have one page open, like so:
A user connected woF_Gu_8ElqMB7a5AAAC A user connected lBAycJ6j0X5Q469SAAAD
However, when emitting messages from the front end, only one connection is used.
Here's how I set up socket.io server side:
// ** bin/www file **
var server = http.createServer(app);
const io = require('socket.io')(server);
// Get socket module and pass it the io socket from here
require('../sockets')(io);
// ** sockets.js **
module.exports = io => {
io.on('connection', (socket) => {
console.log("A user connected", socket.id); // Fires twice with different IDs
socket.on("Setup", data => {
console.log("Data received:", data); // Only fires once per emit from frontend
}
socket.on("disconnect", () => {
console.log("User disconnected");
}
}
Here's how I set up client side, though I'm not sure this matters since it's happening consistently even when I don't have this code in:
import io from 'socket.io-client';
const socket = io(window.location.origin);
Any idea why I'm getting two connections all the time? Thanks!

connectionevent.require('../sockets')(io);? Any chance it is registering a secondconnectevent handler?