javascript - SocketIO 400 Bad Request Error -
i'm pretty new web-dev , have been struggling bug multiple days have no clue how resolve/have no idea causing it. @ point i've exhausted think causing problem, insights appreciated!
i running apache webserver through flask python framework. client-side js (app2.js) follows:
// set basic variables app var socket; $(document).ready(function() { socket = io.connect('https://' + document.domain + ':' + location.port+'/main'); console.log(document.domain); console.log("document ready"); socket.on('disconnect', function() { console.log("disconnecting..."); }); console.log("simple logging"); });
further have reduced .html page loads above script following:
<!doctype html> <html> <body> <h1>my first heading</h1> <p>my first paragraph.</p> </body> <script type="text/javascript" src="//code.jquery.com/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/1.3.6/socket.io.min.js"></script> <script src="{{ url_for('static', filename='scripts/app2.js') }}"></script> </html>
when load page, see following printed in chrome console:
document ready simple logging https://domain/socket.io/?eio=3&transport=polling&t=1465632212131-2&sid=d4082f4636fd4d04a5dcc4b660ee5b2a 400 (bad request) disconnecting... post https://domain/socket.io/?eio=3&transport=polling&t=1465632212141-3&sid=d4082f4636fd4d04a5dcc4b660ee5b2a 400 (bad request)
i have no clue source of these malformed get/post requests are, consequence of them, page becomes non-functional. if refresh page, won't these errors. other times, refresh page , still same error logs , if stay on page long enough, more get/post errors of same flavor , "disconnecting" message sprinkled in.
it's lack of reproducibility throwing me off, , i'm not sure else consider/how go fixing this. i've tried reduce client-side .html/.js files bare minimum see wrong , reason code still failing. happy provide additional information pinpoint going on.
thanks!
Comments
Post a Comment