Description
Describe the bug
When using socket.io-client
version 4.3.2
and above in an app created with create-react-app
, there is no browser debug output at all with localStorage.debug = '*'
. Version 4.2.0
is the latest version I found that did produce correct debug output.
To Reproduce
- Start the server
- Run the client app using
react-scripts start
- Open dev tools, enter
localStorage.debug = '*'
in the console - Make sure 'verbose' is selected in the console's debug levels
- Refresh the page and observe the console output
Please fill the following code example:
Socket.IO server version: 4.4.0
Server
const express = require('express')
const app = express()
const server = require('http').Server(app)
const io = require('socket.io')(server, {
cors: {
origin: '*'
}
})
io.on('connection', socket => {
console.log('socket connected:' + socket.id)
})
const port = 3000
server.listen(port, function () {
console.log("Listening on *:" + port)
})
Socket.IO client version: 4.3.2
Client
import React from 'react'
import ReactDOM from 'react-dom'
import socketIOClient from 'socket.io-client'
const socket = socketIOClient('http://localhost:3000')
function App() {
return (
<div className="App">
Hello, world!
</div>
)
}
ReactDOM.render(
<App />,
document.getElementById('root')
)
Expected behavior
When reloading the page, there should be debug output written to the browser console. With version 4.2.0, the debug output is written. With version 4.3.2 and 4.4.0, there is no output.
Platform:
- Device: Chrome 96
- OS: Ubuntu 20.04
Additional context
I haven't tested this in the browser outside of a React app. I included information about the React environment in case react is somehow messing with the debug content.