Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
webapp-lib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Simon Lefort
webapp-lib
Commits
44c0e627
Commit
44c0e627
authored
6 months ago
by
Clément Pit-Claudel
Browse files
Options
Downloads
Patches
Plain Diff
Implement WebSocketServer.shutdownApp
parent
b499bae4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
jvm/src/main/scala/cs214/webapp/server/web/WebServer.scala
+1
-1
1 addition, 1 deletion
jvm/src/main/scala/cs214/webapp/server/web/WebServer.scala
jvm/src/main/scala/cs214/webapp/server/web/WebSocketsCollection.scala
+8
-0
8 additions, 0 deletions
.../scala/cs214/webapp/server/web/WebSocketsCollection.scala
with
9 additions
and
1 deletion
jvm/src/main/scala/cs214/webapp/server/web/WebServer.scala
+
1
−
1
View file @
44c0e627
...
...
@@ -80,7 +80,7 @@ object WebServer:
instanceId
private
[
web
]
def
shutdownApp
(
instanceId
:
InstanceId
)
:
Unit
=
// Remove references of this app
webSocketServer
.
shutdownApp
(
instanceId
)
val
appId
=
apps
.
remove
(
instanceId
).
map
(
_
.
instance
.
appInfo
.
id
)
clocks
.
get
(
instanceId
).
map
(
_
.
_2
).
foreach
(
_
.
set
(
false
))
clocks
.
remove
(
instanceId
)
...
...
This diff is collapsed.
Click to expand it.
jvm/src/main/scala/cs214/webapp/server/web/WebSocketsCollection.scala
+
8
−
0
View file @
44c0e627
...
...
@@ -35,6 +35,14 @@ private[web] final class WebSocketsCollection():
require
(!
sessions
.
contains
(
instanceId
))
sessions
=
sessions
.
updated
(
instanceId
,
Map
.
empty
.
withDefaultValue
(
Set
.
empty
))
def
shutdownApp
(
instanceId
:
InstanceId
)
:
Unit
=
for
by_client
<-
sessions
.
values
channels
<-
by_client
.
values
channel
<-
channels
do
channel
.
send
(
cask
.
Ws
.
Close
())
sessions
=
sessions
-
instanceId
def
connect
(
instanceId
:
String
,
userId
:
String
)
(
implicit
cc
:
castor.Context
,
log
:
cask.Logger
)
:
cask.WebsocketResult
=
if
WebServer
.
apps
.
contains
(
instanceId
)
then
...
...
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