{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/SignalR/issues/2498","repository_url":"https://api.github.com/repos/aspnet/SignalR","labels_url":"https://api.github.com/repos/aspnet/SignalR/issues/2498/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/SignalR/issues/2498/comments","events_url":"https://api.github.com/repos/aspnet/SignalR/issues/2498/events","html_url":"https://github.com/aspnet/SignalR/issues/2498","id":332596758,"node_id":"MDU6SXNzdWUzMzI1OTY3NTg=","number":2498,"title":"Cannot send SignalR message to specific clients using user(userId)","user":{"login":"LuckyNoS7evin","id":30657709,"node_id":"MDQ6VXNlcjMwNjU3NzA5","avatar_url":"https://avatars2.githubusercontent.com/u/30657709?v=4","gravatar_id":"","url":"https://api.github.com/users/LuckyNoS7evin","html_url":"https://github.com/LuckyNoS7evin","followers_url":"https://api.github.com/users/LuckyNoS7evin/followers","following_url":"https://api.github.com/users/LuckyNoS7evin/following{/other_user}","gists_url":"https://api.github.com/users/LuckyNoS7evin/gists{/gist_id}","starred_url":"https://api.github.com/users/LuckyNoS7evin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LuckyNoS7evin/subscriptions","organizations_url":"https://api.github.com/users/LuckyNoS7evin/orgs","repos_url":"https://api.github.com/users/LuckyNoS7evin/repos","events_url":"https://api.github.com/users/LuckyNoS7evin/events{/privacy}","received_events_url":"https://api.github.com/users/LuckyNoS7evin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-14T23:19:58Z","updated_at":"2018-06-14T23:41:05Z","closed_at":"2018-06-14T23:41:05Z","author_association":"NONE","body":"Cannot send SignalR message to specific clients using user(userId)\r\n\r\nI use `_hubContext.Clients.User(\"luckynos7evin\")` to get the client which does return a connection however client never receives the message.\r\n\r\n(sorry missed the problem description)\r\n\r\n\r\n**Client Code**\r\n```csharp\r\n_hubConnection = new HubConnectionBuilder()\r\n    .WithUrl(\"http://localhost:50040/hubs/game\", options =>\r\n    {\r\n        options.Headers.Add(\"x-gladiator-jwt\", token.Code);\r\n    })\r\n    .Build();\r\n\r\n_hubConnection.On(\"SendPing\", () => \r\n{\r\n    Console.WriteLine($\"Ping\");\r\n});\r\n_hubConnection.On<string, string>(\"SendAction\", (user, message) =>\r\n{\r\n    Console.WriteLine($\"{user}: {message}\");\r\n});\r\n_hubConnection.StartAsync().GetAwaiter().GetResult();\r\n```\r\n\r\nServer Hub:\r\n```csharp\r\n[Authorize(AuthenticationSchemes=\"StreamGladiatorsAuth\")]\r\npublic class GameHub : Hub\r\n{\r\n    public override async Task OnConnectedAsync()\r\n    {\r\n        await Clients.All.SendAsync(\"SendAction\", Context.User.Identity.Name, \"joined\");\r\n    }\r\n\r\n    public override async Task OnDisconnectedAsync(Exception ex)\r\n    {\r\n        await Clients.All.SendAsync(\"SendAction\", Context.User.Identity.Name, \"left\");\r\n    }\r\n\r\n    public async Task Send(string message)\r\n    {\r\n        await Clients.All.SendAsync(\"SendMessage\", Context.User.Identity.Name, message);\r\n    }\r\n}\r\n```\r\n\r\nServer Controller (used for testing only):\r\n```csharp\r\npublic class ViewerController : Controller\r\n{\r\n    private readonly IHubContext<GameHub> _hubContext;\r\n    public ViewerController(IHubContext<GameHub> hubContext)\r\n    {\r\n        _hubContext = hubContext;\r\n    }\r\n       \r\n    [HttpGet]\r\n    public async Task<string> Get()\r\n    {\r\n        await _hubContext.Clients.All.SendAsync(\"SendAction\", \"ping\", \"here\");\r\n\r\n\r\n        await _hubContext.Clients.User(\"luckynos7evin\").SendAsync(\"SendPing\").ContinueWith((value)=> {\r\n\r\n            if(value.IsFaulted)\r\n            {\r\n\r\n            }\r\n\r\n        });\r\n\r\n\r\n        return \"done\";\r\n    }\r\n}\r\n```\r\n\r\nYou can also see the 30 minute highlight on Twitch in which I was trying to debug and figure out what I was doing wrong: [https://www.twitch.tv/videos/273342322](https://www.twitch.tv/videos/273342322)\r\n\r\n* Server-Side NuGet Package: Microsoft.AspNetCore.App 2.1\r\n* Client-Side NuGet Package: Microsoft.AspNetCore.SignalR.Client 1.0\r\n*  C# Client\r\n* Kestrel Server\r\n* Windows 10\r\n\r\n\r\n**Thanks in advance**\r\n\r\nAndy (LuckyNoS7evin)\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/aspnet/SignalR/issues/comments/397470230","html_url":"https://github.com/aspnet/SignalR/issues/2498#issuecomment-397470230","issue_url":"https://api.github.com/repos/aspnet/SignalR/issues/2498","id":397470230,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NzQ3MDIzMA==","user":{"login":"LuckyNoS7evin","id":30657709,"node_id":"MDQ6VXNlcjMwNjU3NzA5","avatar_url":"https://avatars2.githubusercontent.com/u/30657709?v=4","gravatar_id":"","url":"https://api.github.com/users/LuckyNoS7evin","html_url":"https://github.com/LuckyNoS7evin","followers_url":"https://api.github.com/users/LuckyNoS7evin/followers","following_url":"https://api.github.com/users/LuckyNoS7evin/following{/other_user}","gists_url":"https://api.github.com/users/LuckyNoS7evin/gists{/gist_id}","starred_url":"https://api.github.com/users/LuckyNoS7evin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LuckyNoS7evin/subscriptions","organizations_url":"https://api.github.com/users/LuckyNoS7evin/orgs","repos_url":"https://api.github.com/users/LuckyNoS7evin/repos","events_url":"https://api.github.com/users/LuckyNoS7evin/events{/privacy}","received_events_url":"https://api.github.com/users/LuckyNoS7evin/received_events","type":"User","site_admin":false},"created_at":"2018-06-14T23:41:05Z","updated_at":"2018-06-14T23:41:05Z","author_association":"NONE","body":"@anurse wow, missed that, thanks absolutely perfect and quick response to.\r\n\r\nI missed it was NameIdentifier not Name.\r\n\r\nAlso thanks for the advice on the custom auth, we are trying a few things with the dev on this project, a few things to change down the line."}}
{"actor":{"display_login":"LuckyNoS7evin"}}