diff options
author | Saptak S <saptak013@gmail.com> | 2020-11-10 19:57:51 +0530 |
---|---|---|
committer | Saptak S <saptak013@gmail.com> | 2020-11-10 19:57:51 +0530 |
commit | 7ab10a0a57cf9d60b0115e7b3399fad09ee072c3 (patch) | |
tree | ae0a799b299541657a219425620c5fa5c789861b /cli/onionshare_cli/resources/static/js/chat.js | |
parent | b530eb3ceaaf39ab4909b315fb8e079ea9e6856c (diff) | |
download | onionshare-7ab10a0a57cf9d60b0115e7b3399fad09ee072c3.tar.gz onionshare-7ab10a0a57cf9d60b0115e7b3399fad09ee072c3.zip |
Forces socket io to use websocket instead of polling
SocketIO uses the last successful method of transport to communicate. But we
have eventlet in our dependency which allows for websocket, and we ideally
want communications to be over websocket. So specified the transport method
as websocket in socket io connect.
Diffstat (limited to 'cli/onionshare_cli/resources/static/js/chat.js')
-rw-r--r-- | cli/onionshare_cli/resources/static/js/chat.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cli/onionshare_cli/resources/static/js/chat.js b/cli/onionshare_cli/resources/static/js/chat.js index 39547725..69d83869 100644 --- a/cli/onionshare_cli/resources/static/js/chat.js +++ b/cli/onionshare_cli/resources/static/js/chat.js @@ -1,7 +1,12 @@ $(function () { $(document).ready(function () { $('.chat-container').removeClass('no-js'); - var socket = io.connect('http://' + document.domain + ':' + location.port + '/chat'); + var socket = io.connect( + 'http://' + document.domain + ':' + location.port + '/chat', + { + transports: ['websocket'] + } + ); // Store current username received from app context var current_username = $('#username').val(); |