Connect to configurable websocket service

This commit is contained in:
James Allen 2014-11-17 13:38:33 +00:00
parent 804bc16bc8
commit e559c72491
3 changed files with 11 additions and 2 deletions

View file

@ -80,7 +80,8 @@ block content
//- We need to do .replace(/\//g, '\\/') do that '</script>' -> '<\/script>' //- We need to do .replace(/\//g, '\\/') do that '</script>' -> '<\/script>'
//- and doesn't prematurely end the script tag. //- and doesn't prematurely end the script tag.
script(type='text/javascript'). script(type='text/javascript').
window.project_id = "!{project_id}" window.project_id = "!{project_id}";
window.websocketsUrl = "!{settings.websocketsUrl}";
window.userSettings = !{JSON.stringify(userSettings).replace(/\//g, '\\/')}; window.userSettings = !{JSON.stringify(userSettings).replace(/\//g, '\\/')};
window.user = !{JSON.stringify(user).replace(/\//g, '\\/')}; window.user = !{JSON.stringify(user).replace(/\//g, '\\/')};
window.csrfToken = "!{csrfToken}"; window.csrfToken = "!{csrfToken}";

View file

@ -103,6 +103,14 @@ module.exports =
templates: templates:
user_id: process.env.TEMPLATES_USER_ID or "5395eb7aad1f29a88756c7f2" user_id: process.env.TEMPLATES_USER_ID or "5395eb7aad1f29a88756c7f2"
# The websocket layer of ShareLaTeX runs as separate service.
# When running locally or in development, you can point the client to this
# service directly. If you are running behind a reverse proxy (Nginx, etc)
# then websocketsUrl should be the same as siteUrl, with your reverse
# proxy responible for sending websocket traffic to the websocket service
# rather than connecting directly.
websocketsUrl: "http://localhost:3026"
# Where your instance of ShareLaTeX can be found publically. Used in emails # Where your instance of ShareLaTeX can be found publically. Used in emails
# that are sent out, generated links, etc. # that are sent out, generated links, etc.

View file

@ -14,7 +14,7 @@ define [], () ->
@$scope.$on "editor:change", () => @$scope.$on "editor:change", () =>
@lastUpdated = new Date() @lastUpdated = new Date()
@ide.socket = io.connect null, @ide.socket = io.connect window.websocketsUrl,
reconnect: false reconnect: false
"force new connection": true "force new connection": true