Skip to content

Commit

Permalink
Merge pull request #97 from reetchow/feature/wsuri
Browse files Browse the repository at this point in the history
websocket uri change for api-layer
  • Loading branch information
1000TurquoisePogs authored Mar 29, 2019
2 parents 09de6f8 + a482d3d commit 1fdf5b9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bootstrap/src/uri/mvd-uri.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import { PluginManager } from 'zlux-base/plugin-manager/plugin-manager'

const uri_prefix = window.location.pathname.split('ZLUX/plugins/')[0];
// const proxy_mode = (uri_prefix !== '/') ? true : false; // Tells whether we're behind API layer (true) or not (false)
const proxy_mode = (uri_prefix !== '/') ? true : false; // Tells whether we're behind API layer (true) or not (false)

export class MvdUri implements ZLUX.UriBroker {
rasUri(uri: string): string {
Expand Down Expand Up @@ -108,8 +108,11 @@ export class MvdUri implements ZLUX.UriBroker {
}
const protocol = window.location.protocol;
const wsProtocol = (protocol === 'https:') ? 'wss:' : 'ws:';
return `${wsProtocol}//${window.location.host}${this.pluginRootUri(plugin)}`
const uri = `${wsProtocol}//${window.location.host}${this.pluginRootUri(plugin)}`
+ `services/${serviceName}/${version}/${relativePath}`;
// This is a workaround for the mediation layer not having a dynamic way to get the websocket uri for zlux
// Since we know our uri is /ui/v1/zlux/ behind the api-layer we replace the ui with ws to get /ws/v1/zlux/
return proxy_mode ? uri.replace('/ui/', '/ws/') : uri;
}

/**
Expand Down

0 comments on commit 1fdf5b9

Please sign in to comment.