Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iobserve-ui-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iobserve-ui
iobserve-ui-frontend
Commits
3557def8
Commit
3557def8
authored
8 years ago
by
Mathis Neumann
Browse files
Options
Downloads
Patches
Plain Diff
temporarily disable websocket reconnects for production (heroku) deployment
parent
0e8fafc0
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/adapters/_baseAdapter.js
+2
-1
2 additions, 1 deletion
app/adapters/_baseAdapter.js
app/services/changelog-stream.js
+13
-10
13 additions, 10 deletions
app/services/changelog-stream.js
config/environment.js
+7
-0
7 additions, 0 deletions
config/environment.js
with
22 additions
and
11 deletions
app/adapters/_baseAdapter.js
+
2
−
1
View file @
3557def8
import
Ember
from
'
ember
'
;
import
RESTAdapter
from
'
ember-data/adapters/rest
'
;
import
FixtureAdapter
from
'
ember-data-fixture-adapter
'
;
import
ENV
from
'
iobserve-ui/config/environment
'
;
export
default
RESTAdapter
.
extend
({
host
:
'
http://localhost:8080
'
,
// TODO: replace with live url
host
:
ENV
.
APP
.
API_ROOT
,
namespace
:
'
v1
'
,
session
:
Ember
.
inject
.
service
()
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
app/services/changelog-stream.js
+
13
−
10
View file @
3557def8
import
Ember
from
'
ember
'
;
import
ENV
from
'
iobserve-ui/config/environment
'
;
export
default
Ember
.
Service
.
extend
({
changelogQueue
:
Ember
.
inject
.
service
(),
...
...
@@ -11,7 +12,7 @@ export default Ember.Service.extend({
this
.
set
(
'
shouldClose
'
,
false
);
this
.
debug
(
'
setting up websocket
'
,
systemId
);
const
socket
=
new
WebSocket
(
`
ws://localhost:8080
/v1/changelogstream/
${
systemId
}
`
);
// TODO: from environment!
const
socket
=
new
WebSocket
(
`
${
ENV
.
APP
.
WEBSOCKET_ROOT
}
/v1/changelogstream/
${
systemId
}
`
);
this
.
set
(
'
socket
'
,
socket
);
socket
.
onopen
=
this
.
get
(
'
events.onOpen
'
).
bind
(
this
);
...
...
@@ -19,15 +20,17 @@ export default Ember.Service.extend({
socket
.
onmessage
=
this
.
get
(
'
events.onMessage
'
).
bind
(
this
);
// automatically reconnect
socket
.
onclose
=
()
=>
{
if
(
!
this
.
get
(
'
shouldClose
'
))
{
this
.
debug
(
'
connection lost, reconnecting!
'
);
this
.
set
(
'
reconnectionTimeout
'
,
setTimeout
(()
=>
{
this
.
connect
(
systemId
);
this
.
set
(
'
reconnectionTimeout
'
,
null
);
},
500
));
}
};
if
(
ENV
.
APP
.
WEBSOCKET_RECONNECT
)
{
socket
.
onclose
=
()
=>
{
if
(
!
this
.
get
(
'
shouldClose
'
))
{
this
.
debug
(
'
connection lost, reconnecting!
'
);
this
.
set
(
'
reconnectionTimeout
'
,
setTimeout
(()
=>
{
this
.
connect
(
systemId
);
this
.
set
(
'
reconnectionTimeout
'
,
null
);
},
500
));
}
};
}
// close socket connection when the user closes the window/tab or nagivates to a different website
window
.
onbeforeunload
=
this
.
get
(
'
disconnect
'
).
bind
(
this
);
...
...
This diff is collapsed.
Click to expand it.
config/environment.js
+
7
−
0
View file @
3557def8
...
...
@@ -17,6 +17,9 @@ module.exports = function(environment) {
APP
:
{
// Here you can pass flags/options to your application instance
// when it is created
API_ROOT
:
'
http://iobserve-api.herokuapp.com
'
,
WEBSOCKET_ROOT
:
'
ws://iobserve-api.herokuapp.com
'
,
WEBSOCKET_RECONNECT
:
false
// not running on heroku/jetty-runner
}
};
...
...
@@ -27,6 +30,10 @@ module.exports = function(environment) {
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
ENV
.
APP
.
API_ROOT
=
'
http://localhost:8080
'
;
ENV
.
APP
.
WEBSOCKET_ROOT
=
'
ws://localhost:8080
'
;
ENV
.
APP
.
WEBSOCKET_RECONNECT
=
true
;
}
if
(
environment
===
'
test
'
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment