Commit b6ad58a9 by David Taylor Committed by GitHub

Merge pull request #24 from jeff-phillips-18/fixes

Use web socket protocol for ws requests when server block specifies protocol
parents 62b15616 51c089e8
...@@ -2206,13 +2206,14 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR ...@@ -2206,13 +2206,14 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR
return null; return null;
} }
var serviceProtocol = apiInfo.protocol || window.location.protocol;
var protocol; var protocol;
params = params || {}; params = params || {};
if (isWebsocket) { if (isWebsocket) {
protocol = window.location.protocol === "http:" ? "ws" : "wss"; protocol = serviceProtocol === "http:" ? "ws" : "wss";
} }
else { else {
protocol = window.location.protocol === "http:" ? "http" : "https"; protocol = serviceProtocol === "http:" ? "http" : "https";
} }
if (context && context.namespace && !params.namespace) { if (context && context.namespace && !params.namespace) {
...@@ -2233,7 +2234,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR ...@@ -2233,7 +2234,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR
} }
var template; var template;
var templateOptions = { var templateOptions = {
protocol: apiInfo.protocol || protocol, protocol: protocol,
hostPort: apiInfo.hostPort, hostPort: apiInfo.hostPort,
prefix: apiInfo.prefix, prefix: apiInfo.prefix,
group: apiInfo.group, group: apiInfo.group,
......
...@@ -3415,13 +3415,14 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR ...@@ -3415,13 +3415,14 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR
return null; return null;
} }
var serviceProtocol = apiInfo.protocol || window.location.protocol;
var protocol; var protocol;
params = params || {}; params = params || {};
if (isWebsocket) { if (isWebsocket) {
protocol = window.location.protocol === "http:" ? "ws" : "wss"; protocol = serviceProtocol === "http:" ? "ws" : "wss";
} }
else { else {
protocol = window.location.protocol === "http:" ? "http" : "https"; protocol = serviceProtocol === "http:" ? "http" : "https";
} }
if (context && context.namespace && !params.namespace) { if (context && context.namespace && !params.namespace) {
...@@ -3442,7 +3443,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR ...@@ -3442,7 +3443,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR
} }
var template; var template;
var templateOptions = { var templateOptions = {
protocol: apiInfo.protocol || protocol, protocol: protocol,
hostPort: apiInfo.hostPort, hostPort: apiInfo.hostPort,
prefix: apiInfo.prefix, prefix: apiInfo.prefix,
group: apiInfo.group, group: apiInfo.group,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -1210,13 +1210,14 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR ...@@ -1210,13 +1210,14 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR
return null; return null;
} }
var serviceProtocol = apiInfo.protocol || window.location.protocol;
var protocol; var protocol;
params = params || {}; params = params || {};
if (isWebsocket) { if (isWebsocket) {
protocol = window.location.protocol === "http:" ? "ws" : "wss"; protocol = serviceProtocol === "http:" ? "ws" : "wss";
} }
else { else {
protocol = window.location.protocol === "http:" ? "http" : "https"; protocol = serviceProtocol === "http:" ? "http" : "https";
} }
if (context && context.namespace && !params.namespace) { if (context && context.namespace && !params.namespace) {
...@@ -1237,7 +1238,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR ...@@ -1237,7 +1238,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR
} }
var template; var template;
var templateOptions = { var templateOptions = {
protocol: apiInfo.protocol || protocol, protocol: protocol,
hostPort: apiInfo.hostPort, hostPort: apiInfo.hostPort,
prefix: apiInfo.prefix, prefix: apiInfo.prefix,
group: apiInfo.group, group: apiInfo.group,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment