X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fframework%2Fcore%2Fapi_utils%2Fsockets.js;fp=skyquake%2Fframework%2Fcore%2Fapi_utils%2Fsockets.js;h=5e0b25bfb9cc651c0b02a3d94f46ccfa5d5c54cf;hp=607659476d6339fc4a675a950b8cf1bebdfc1c0f;hb=13f32c0c3cbad3b1d70d20342f44c65328c91ec9;hpb=df332f582aae48baaf5b1fa51c15f3bf0bab0443 diff --git a/skyquake/framework/core/api_utils/sockets.js b/skyquake/framework/core/api_utils/sockets.js index 607659476..5e0b25bfb 100644 --- a/skyquake/framework/core/api_utils/sockets.js +++ b/skyquake/framework/core/api_utils/sockets.js @@ -32,17 +32,9 @@ var Promise = require('promise'); var url = require('url'); var sockjs = require('sockjs'); var websocket_multiplex = require('websocket-multiplex'); +var utils = require('./utils.js'); -function getPortForProtocol (protocol) { - switch (protocol) { - case 'http': - return 8000; - case 'https': - return 8443; - } -} - var Subscriptions = function() { this.ID = 0; this.socketServers = {}; @@ -85,7 +77,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 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 {