Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grégoire Locqueville
purescript-gargantext
Commits
accde78f
Verified
Commit
accde78f
authored
Jun 17, 2024
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[websockets] implement reconnection when WS closes
parent
97d4977f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
App.purs
src/Gargantext/Components/App/App.purs
+2
-7
Notifications.purs
src/Gargantext/Components/Notifications.purs
+8
-0
No files found.
src/Gargantext/Components/App/App.purs
View file @
accde78f
...
...
@@ -38,16 +38,12 @@ appCpt = here.component "container" cpt where
-- |
-- load Local Storage cache (if exists)
useFirstEffect' $
useFirstEffect' $
do
R2.loadLocalStorageState R2.appParamsKey cache
-- | Render
-- |
pure $
hydrateStore
{ cacheParams: cache'
}
pure $ hydrateStore { cacheParams: cache' }
--------------------------------------------------------------
...
...
@@ -87,7 +83,6 @@ hydrateStoreCpt = here.component "hydrateStore" cpt where
mainApp :: R2.Leaf ()
mainApp = R2.leaf mainAppCpt
mainAppCpt :: R.Component ()
mainAppCpt = here.component "main" cpt where
cpt _ _ = do
...
...
src/Gargantext/Components/Notifications.purs
View file @
accde78f
...
...
@@ -14,6 +14,7 @@ import Data.Traversable (for, traverse)
import Data.Tuple (Tuple(..))
import Effect (Effect)
import Effect.Ref as Ref
import Effect.Timer (setTimeout)
import Effect.Var (($=))
import Effect.Var as Var
import Foreign as F
...
...
@@ -292,6 +293,13 @@ connect ws@(WSNotification ws') url session = do
let subscription = WSSubscribe topic
here.log2 "[connect] pending subscription" subscription
send ws subscription)
conn.onclose $= (\_ -> do
Ref.write Nothing ws'.connection
void $ setTimeout 1000 $ do
connect ws url session
)
conn.onmessage $= onmessage
pure unit
...
...
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