Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Cloud_Computing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexander Tim Hobelsberger
Cloud_Computing
Commits
5a81b22e
Commit
5a81b22e
authored
Dec 18, 2022
by
Alexander Tim Hobelsberger
Browse files
Options
Downloads
Patches
Plain Diff
UserList
parent
c32b3b3a
No related branches found
No related tags found
1 merge request
!10
Skalierbarkeit
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
index.js
+3
-3
3 additions, 3 deletions
index.js
views/index.html
+1
-1
1 addition, 1 deletion
views/index.html
with
4 additions
and
4 deletions
index.js
+
3
−
3
View file @
5a81b22e
...
@@ -228,7 +228,7 @@ io.on('connection', (socket) => {
...
@@ -228,7 +228,7 @@ io.on('connection', (socket) => {
*
*
* Description:
* Description:
* Function will take the username from response and append it together with the socketID to map activeUsers.
* Function will take the username from response and append it together with the socketID to map activeUsers.
* after appending, i
p
.emit() will send the updated userlist to all users who are currently online.
* after appending, i
o
.emit() will send the updated userlist to all users who are currently online.
*
*
* @param {socket} socket
* @param {socket} socket
* @param {Object} response
* @param {Object} response
...
@@ -241,9 +241,9 @@ async function addUserToActiveUsers(response, socket) {
...
@@ -241,9 +241,9 @@ async function addUserToActiveUsers(response, socket) {
activeUsers
.
set
(
socket
.
id
,
response
.
name
);
activeUsers
.
set
(
socket
.
id
,
response
.
name
);
clientActiveUsers
.
set
(
activeUsers
.
size
);
clientActiveUsers
.
set
(
activeUsers
.
size
);
console
.
log
(
activeUsers
);
var
userArr
=
Array
.
from
(
activeUsers
.
values
());
var
userArr
=
Array
.
from
(
activeUsers
.
values
());
//
console.log(userArr);
console
.
log
(
userArr
);
socket
.
emit
(
'
updateUserlist
'
,
{
socket
.
emit
(
'
updateUserlist
'
,
{
userList
:
userArr
userList
:
userArr
});
});
...
...
This diff is collapsed.
Click to expand it.
views/index.html
+
1
−
1
View file @
5a81b22e
...
@@ -257,7 +257,7 @@
...
@@ -257,7 +257,7 @@
* @listens socket.on() 'updateUserList' event
* @listens socket.on() 'updateUserList' event
*/
*/
socket
.
on
(
'
updateUserlist
'
,
function
(
req
)
{
socket
.
on
(
'
updateUserlist
'
,
function
(
req
)
{
console
.
log
(
"
Update
"
);
console
.
log
(
"
Update
"
,
req
);
var
userList
=
req
.
userList
;
var
userList
=
req
.
userList
;
console
.
log
(
"
req
"
,
req
.
userList
[
0
]);
console
.
log
(
"
req
"
,
req
.
userList
[
0
]);
...
...
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
sign in
to comment