projects
/
osm
/
UI.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "RIFT-16172: Project switch does not affect polling and socket pages." into...
[osm/UI.git]
/
skyquake
/
framework
/
core
/
api_utils
/
sockets.js
diff --git
a/skyquake/framework/core/api_utils/sockets.js
b/skyquake/framework/core/api_utils/sockets.js
index
6076594
..
2e6779c
100644
(file)
--- a/
skyquake/framework/core/api_utils/sockets.js
+++ b/
skyquake/framework/core/api_utils/sockets.js
@@
-32,17
+32,10
@@
var Promise = require('promise');
var url = require('url');
var sockjs = require('sockjs');
var websocket_multiplex = require('websocket-multiplex');
var url = require('url');
var sockjs = require('sockjs');
var websocket_multiplex = require('websocket-multiplex');
+var utils = require('./utils.js');
+var configurationAPI = require('../modules/api/configuration.js');
-function getPortForProtocol (protocol) {
- switch (protocol) {
- case 'http':
- return 8000;
- case 'https':
- return 8443;
- }
-}
-
var Subscriptions = function() {
this.ID = 0;
this.socketServers = {};
var Subscriptions = function() {
this.ID = 0;
this.socketServers = {};
@@
-85,7
+78,7
@@
Subscriptions.prototype.subscribe = function(req, callback) {
var origin = '';
if (req.query['api_server']) {
var api_server_protocol = req.query['api_server'].match(protocolTest)[1];
var origin = '';
if (req.query['api_server']) {
var api_server_protocol = req.query['api_server'].match(protocolTest)[1];
- var api_server_origin = req.query['api_server'] + ':' + getPortForProtocol(api_server_protocol);
+ var api_server_origin = req.query['api_server'] + ':' +
utils.
getPortForProtocol(api_server_protocol);
origin = api_server_origin;
protocol = api_server_protocol;
} else {
origin = api_server_origin;
protocol = api_server_protocol;
} else {
@@
-99,7
+92,6
@@
Subscriptions.prototype.subscribe = function(req, callback) {
var a = url.resolve(origin, req.baseUrl);
var b = url.resolve(a, URL);
URL = b;
var a = url.resolve(origin, req.baseUrl);
var b = url.resolve(a, URL);
URL = b;
- console.log('DEBUG URL IS', URL);
} else {
protocol = protocol[1]
}
} else {
protocol = protocol[1]
}
@@
-286,12
+278,12
@@
function PollingSocket(url, req, interval, config) {
self.isClosed = false;
var requestHeaders = {};
_.extend(requestHeaders, {
self.isClosed = false;
var requestHeaders = {};
_.extend(requestHeaders, {
-
'Authorization': req.get('Authorization
')
+
Cookie: req.get('Cookie
')
});
var pollServer = function() {
Request({
});
var pollServer = function() {
Request({
- url: u
rl
,
+ url: u
tils.projectContextUrl(req, url)
,
method: config.method || 'GET',
headers: requestHeaders,
json: config.payload,
method: config.method || 'GET',
headers: requestHeaders,
json: config.payload,