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
160
Issues
160
List
Board
Labels
Milestones
Merge Requests
14
Merge Requests
14
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
gargantext
haskell-gargantext
Commits
d79c579a
Verified
Commit
d79c579a
authored
May 11, 2024
by
Przemyslaw Kaminski
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[websocket] add Subscription data
parent
245bc254
Pipeline
#6083
failed with stages
in 6 minutes and 10 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
10 deletions
+21
-10
AsyncUpdates.hs
src/Gargantext/Core/AsyncUpdates.hs
+21
-10
No files found.
src/Gargantext/Core/AsyncUpdates.hs
View file @
d79c579a
...
...
@@ -53,7 +53,7 @@ server and client.
-- | Various update actions
data
UpdateAction
=
data
Topic
=
-- | Update given Servant Job (we currently send a request every
-- | second to get job status).
-- UpdateJob JobID
...
...
@@ -63,7 +63,7 @@ data UpdateAction =
deriving
(
Eq
,
Show
)
--
NOTE
: I'm not sure if UserAction/UserSource is needed. I initially
--
TODO
: I'm not sure if UserAction/UserSource is needed. I initially
-- created that to mark who initiated the action, but I think we don't
-- need it.
--
...
...
@@ -78,7 +78,7 @@ data UserSource =
-- | Action possibly associated with user who triggered it (there can
-- be system actions as well)
data
UserAction
=
UserAction
UserSource
UpdateAction
UserAction
UserSource
Topic
deriving
(
Eq
,
Show
)
...
...
@@ -99,16 +99,27 @@ notificationsForUserAction :: UserAction -> m [ UserNotification ]
notificationsForUserAction
=
undefined
-- | Stores connection type associated with given user.
-- | A connected user can be either associated with his UserId or
-- don't have it, since he's not logged in (for public messages).
data
ConnectedUser
=
CUUser
UserId
|
CUPublic
deriving
(
Eq
,
Show
)
-- | Stores connection type associated with given user, subscribed to
-- | a given topic.
--
-- We probably should set conn = Servant.API.WebSocket.Connection
data
ConnectedUser
conn
=
ConnectedUser
UserId
conn
data
Subscription
conn
=
Subscription
ConnectedUser
conn
Topic
-- | Given a UserNotification and all
connected users, send it to
--
interested ones. Possibly we could make this function as part of
--
a
typeclass so that we can decide how to send the notification
-- | Given a UserNotification and all
subscriptions, send it to all
--
matching ones. Possibly we could make this function as part of a
-- typeclass so that we can decide how to send the notification
-- based on whether we choose pure WebSockets, NATS or something
-- else.
sendNotification
::
UserNotification
->
[
ConnectedUser
conn
]
->
m
()
sendNotification
::
UserNotification
->
[
Subscription
conn
]
->
m
()
sendNotification
=
undefined
Przemyslaw Kaminski
@cgenie
mentioned in commit
5660aec0
·
Oct 08, 2024
mentioned in commit
5660aec0
mentioned in commit 5660aec07ec5a0a0a5468f440092c1a8f57a864e
Toggle commit list
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