Skip to content
This repository has been archived by the owner on Sep 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #44 from erlanglab/dynamic-port
Browse files Browse the repository at this point in the history
Remove hardcoded port from UI and set default to 37575
  • Loading branch information
Michal Slaski authored Apr 12, 2017
2 parents 329e265 + 4e47d45 commit 4c0c379
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/epl/src/epl_app.erl
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ run5(PluginApps, Args) ->
]),

Port = case proplists:lookup(port, Args) of
none -> 8000;
none -> 37575;
{port, N} when is_list(N) -> list_to_integer(N);
{port, N} when is_integer(N) -> N
end,
Expand Down
9 changes: 7 additions & 2 deletions ui/src/sockets.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,13 @@ let socketsArray = [];

export const createSockets = (sockets: any) => {
socketsArray = Object.keys(sockets).map(route => {
const { hostname } = window.location;
let ws = new WebSocket(`ws://${hostname}:8000/${route}`);
let { hostname, port } = window.location;

if (process.env.NODE_ENV !== 'production') {
port = 37575;
}

let ws = new WebSocket(`ws://${hostname}:${port}/${route}`);

const handlers = Object.keys(sockets[route].topics).reduce(
(acc, topic) => {
Expand Down

0 comments on commit 4c0c379

Please sign in to comment.