Try long-polling first, then try websocket

This makes it so that SocketIO uses long polling to set up the
connection before switching to websocket, instead of immediately using
websocket.

This seems to resolve issues where the browser sometimes can't connect
to the websocket server until the window has been open for a minute.
This commit is contained in:
Gnome Ann 2021-12-17 13:18:47 -05:00
parent 769333738d
commit 12718dbe24
2 changed files with 2 additions and 2 deletions

View File

@ -1619,7 +1619,7 @@ $(document).ready(function(){
seqselcontents = $("#seqselcontents"); seqselcontents = $("#seqselcontents");
// Connect to SocketIO server // Connect to SocketIO server
socket = io.connect(window.document.origin, {transports: ['websocket', 'polling']}); socket = io.connect(window.document.origin, {transports: ['polling', 'websocket']});
socket.on('from_server', function(msg) { socket.on('from_server', function(msg) {
if(msg.cmd == "connected") { if(msg.cmd == "connected") {

View File

@ -7,7 +7,7 @@
<script src="static/jquery-3.6.0.min.js"></script> <script src="static/jquery-3.6.0.min.js"></script>
<script src="static/jquery-ui.sortable.min.js"></script> <script src="static/jquery-ui.sortable.min.js"></script>
<script src="static/socket.io.min.js"></script> <script src="static/socket.io.min.js"></script>
<script src="static/application.js?ver=1.16.4g"></script> <script src="static/application.js?ver=1.16.4h"></script>
<script src="static/bootstrap.min.js"></script> <script src="static/bootstrap.min.js"></script>
<script src="static/bootstrap-toggle.min.js"></script> <script src="static/bootstrap-toggle.min.js"></script>
<script src="static/rangy-core.min.js"></script> <script src="static/rangy-core.min.js"></script>