Merge pull request #1480 from sharelatex/bg-allow-separate-websocket-url

allow setting separate wsUrl for websockets

GitOrigin-RevId: afd4f441397c6b4b402e342f1dec01c971847a0f
This commit is contained in:
Brian Gough 2019-02-06 10:03:33 +00:00 committed by sharelatex
parent 4840d9e9bd
commit c51461da09
4 changed files with 7 additions and 1 deletions

View file

@ -68,6 +68,7 @@ html(
script.
window.sharelatex = {
siteUrl: '#{settings.siteUrl}',
wsUrl: '#{settings.wsUrl}',
jsPath: '#{jsPath}',
sixpackDomain: '#{settings.sixpack.domain}'
};

View file

@ -188,6 +188,9 @@ module.exports = settings =
# that are sent out, generated links, etc.
siteUrl : siteUrl = process.env['PUBLIC_URL'] or 'http://localhost:3000'
# Optional separate location for websocket connections, if unset defaults to siteUrl.
wsUrl: process.env['WEBSOCKET_URL']
# cookie domain
# use full domain for cookies to only be accessible from that domain,
# replace subdomain with dot to have them accessible on all subdomains

View file

@ -185,6 +185,7 @@ define([
ide.validFileRegex = '^[^*/]*$' // Don't allow * and /
ide.wsUrl = window.sharelatex.wsUrl || null // websocket url (if defined)
ide.project_id = $scope.project_id = window.project_id
ide.$scope = $scope

View file

@ -33,6 +33,7 @@ define([], function() {
constructor(ide, $scope) {
this.ide = ide
this.$scope = $scope
this.wsUrl = ide.wsUrl || null // websocket url (if defined)
if (typeof io === 'undefined' || io === null) {
console.error(
'Socket.io javascript not loaded. Please check that the real-time service is running and accessible.'
@ -94,7 +95,7 @@ define([], function() {
})
this.ide.socket = io.connect(
null,
this.wsUrl,
{
reconnect: false,
'connect timeout': 30 * 1000,