Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tsi1-backend
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
Rodrigo Sastre Marotta
tsi1-backend
Commits
425dea8a
Commit
425dea8a
authored
4 years ago
by
Enzo Santangelo Dodera
Browse files
Options
Downloads
Patches
Plain Diff
Update ChatHub.cs
parent
c8f82062
No related branches found
Branches containing commit
No related tags found
2 merge requests
!20
merge from develop
,
!18
Feature/chat signalr
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tsi1.Api/Tsi1.Api/SignalR/ChatHub.cs
+2
-6
2 additions, 6 deletions
Tsi1.Api/Tsi1.Api/SignalR/ChatHub.cs
with
2 additions
and
6 deletions
Tsi1.Api/Tsi1.Api/SignalR/ChatHub.cs
+
2
−
6
View file @
425dea8a
using
AutoMapper
;
using
AutoMapper
;
using
Microsoft.AspNetCore.Authorization
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.SignalR
;
...
...
@@ -38,15 +38,12 @@ namespace Tsi1.Api.SignalR
public
override
async
Task
OnConnectedAsync
()
{
var
httpContext
=
Context
.
GetHttpContext
();
//var otherUser = httpContext.Request.Query["user"].ToString();
var
otherUserId
=
int
.
Parse
(
httpContext
.
Request
.
Query
[
"id"
].
ToString
());
//
var
userName = Context.User.FindFirst("Username").Value
;
var
otherUserId
=
int
.
Parse
(
httpContext
.
Request
.
Query
[
"id"
].
ToString
())
;
var
userId
=
int
.
Parse
(
Context
.
User
.
Claims
.
FirstOrDefault
(
x
=>
x
.
Type
==
"Id"
).
Value
);
var
tenantId
=
int
.
Parse
(
Context
.
User
.
Claims
.
FirstOrDefault
(
x
=>
x
.
Type
==
"TenantId"
).
Value
);
var
groupName
=
GetGroupName
(
userId
,
otherUserId
);
await
Groups
.
AddToGroupAsync
(
Context
.
ConnectionId
,
groupName
);
...
...
@@ -95,7 +92,6 @@ namespace Tsi1.Api.SignalR
var
messageDto
=
await
_messageService
.
Send
(
newMessage
);
await
Clients
.
Group
(
groupName
).
SendAsync
(
"NewMessage"
,
messageDto
);
}
private
async
Task
<
Group
>
AddToGroup
(
string
groupName
)
...
...
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