127.0.0.1 - - [25/Mar/2023 23:49:10] "GET / HTTP/1.1" 200 -
The client is using an unsupported version of the Socket.IO or Engine.IO protocols (further occurrences of this error will be logged with level INFO)
127.0.0.1 - - [25/Mar/2023 23:49:11] "GET /socket.io/?EIO=3&transport=polling&t=OSP_l7y HTTP/1.1" 400 -
This is because the index page was using 2.1.0 version of socket io causing this issue.
Changing to like below solved the issue
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>SocketIO example</title>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/socket.io/4.5.0/socket.io.js"></script>
<script type="text/javascript">
$(document).ready(function() {
console.log('on ready function call ')
// sending a connect request to the server.
var socket = io.connect('http://127.0.0.1:5000');
console.log('connection complete ')
socket.on('after connect', function(msg) {
console.log('After connect', msg);
$('#log').append('<br>' + $('<div/>').text('Received: ' + msg.data).html());
});
});
</script>
</head>
<body>
<h1>SocketIO Example</h1>
<h2>Receive:</h2>
<div id="log"></div>
</body>
</html>
references:
https://stackoverflow.com/questions/66069215/the-client-is-using-an-unsupported-version-of-the-socket-io-or-engine-io-protoco
No comments:
Post a Comment