Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-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
haskell-gargantext
Commits
5bcb8731
Verified
Commit
5bcb8731
authored
May 29, 2024
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[websockets] ws server test for nanomsg
Also, will use stm containers
parent
708029b2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
4 deletions
+21
-4
Main.hs
bin/gargantext-central-exchange/Main.hs
+12
-0
gargantext.cabal
gargantext.cabal
+1
-0
Dispatcher.hs
src/Gargantext/Core/AsyncUpdates/Dispatcher.hs
+8
-4
No files found.
bin/gargantext-central-exchange/Main.hs
View file @
5bcb8731
...
...
@@ -25,18 +25,29 @@ import Options.Applicative
data
Command
=
Server
|
WSServer
|
Client
parser
::
Parser
(
IO
()
)
parser
=
subparser
(
command
"server"
(
info
(
pure
gServer
)
idm
)
<>
command
"ws-server"
(
info
(
pure
wsServer
)
idm
)
<>
command
"client"
(
info
(
pure
gClient
)
idm
)
)
main
::
IO
()
main
=
join
$
execParser
(
info
parser
idm
)
wsServer
::
IO
()
wsServer
=
do
withSocket
Pull
$
\
ws
->
do
_
<-
connect
ws
"ws://localhost:5566"
forever
$
do
putText
"[wsServer] receiving"
r
<-
recv
ws
C
.
putStrLn
r
gClient
::
IO
()
gClient
=
do
withSocket
Push
$
\
s
->
do
...
...
@@ -51,3 +62,4 @@ gClient = do
let
str2
=
"{
\"
type
\"
:
\"
update_tree_first_level
\"
,
\"
node_id
\"
: -2}"
C
.
putStrLn
$
C
.
pack
"sending: "
<>
str2
send
s
str2
gargantext.cabal
View file @
5bcb8731
...
...
@@ -638,6 +638,7 @@ library
, split ^>= 0.2.3.4
, stemmer ^>= 0.5.2
, stm ^>= 2.5.0.1
, stm-containers >= 1.2.1 && < 1.3
, swagger2 ^>= 2.6
, taggy-lens ^>= 0.1.2
, tagsoup ^>= 0.14.8
...
...
src/Gargantext/Core/AsyncUpdates/Dispatcher.hs
View file @
5bcb8731
...
...
@@ -224,8 +224,8 @@ wsServer authSettings subscriptions = streamData
threadDelay
$
10
*
1000000
wsLoop
ws
=
flip
finally
disconnect
$
do
putText
"[wsLoop] connecting"
wsLoop'
CUPublic
putText
"[wsLoop] connecting"
wsLoop'
CUPublic
where
wsLoop'
user
=
do
...
...
@@ -299,9 +299,13 @@ ce_listener subscriptions = do
Nothing
->
putText
"[ce_listener] unknown message from central exchange"
Just
ceMessage
->
do
subs
<-
atomically
$
readTVar
subscriptions
--
TODO
This isn't safe: we atomically fetch subscriptions,
--
NOTE
This isn't safe: we atomically fetch subscriptions,
-- then send notifications one by one. In the meantime, a
-- subscription could end or new ones could appear
-- subscription could end or new ones could appear (but is
-- this really a problem? I new subscription comes up, then
-- probably they already fetch new tree anyways, and if old
-- one drops in the meantime, it won't listen to what we
-- send...)
let
filteredSubs
=
filterCEMessageSubs
ceMessage
subs
mapM_
(
sendNotification
ceMessage
)
filteredSubs
where
...
...
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