Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Julien Veyssier
funkwhale
Commits
ef224e9f
Verified
Commit
ef224e9f
authored
Jun 11, 2018
by
Eliot Berriot
Browse files
Fixed
#287
: duplicated websocket connexion on timeline
parent
4c81de92
Changes
2
Hide whitespace changes
Inline
Side-by-side
changes/changelog.d/287.bugfix
0 → 100644
View file @
ef224e9f
Fixed duplicated websocket connexion on timeline (#287)
front/src/views/instance/Timeline.vue
View file @
ef224e9f
...
...
@@ -34,6 +34,7 @@ export default {
data
()
{
return
{
isLoading
:
false
,
bridge
:
null
,
components
:
{
'
Like
'
:
Like
,
'
Listen
'
:
Listen
...
...
@@ -44,6 +45,9 @@ export default {
this
.
openWebsocket
()
this
.
fetchEvents
()
},
destroyed
()
{
this
.
disconnect
()
},
computed
:
{
...
mapState
({
events
:
state
=>
state
.
instance
.
events
...
...
@@ -58,14 +62,22 @@ export default {
self
.
$store
.
commit
(
'
instance/events
'
,
response
.
data
.
results
)
})
},
disconnect
()
{
if
(
!
this
.
bridge
)
{
return
}
this
.
bridge
.
socket
.
close
(
1000
,
'
goodbye
'
,
{
keepClosed
:
true
})
},
openWebsocket
()
{
if
(
!
this
.
$store
.
state
.
auth
.
authenticated
)
{
return
}
this
.
disconnect
()
let
self
=
this
let
token
=
this
.
$store
.
state
.
auth
.
token
// let token = 'test'
const
bridge
=
new
WebSocketBridge
()
this
.
bridge
=
bridge
bridge
.
connect
(
`/api/v1/instance/activity?token=
${
token
}
`
,
null
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment