Hi, I'm using SignalR with .net core2 in Visual studio 2017 to send message to all users. But I don't know how can I add the SignalR client library.
My current javascript code is :
<script src="Scripts/jquery-1.6.4.min.js"
type="text/javascript"></script>
<script src="Scripts/jquery.signalR-0.5.2.min.js"
type="text/javascript"></script>
<script src="signalr/hubs" type="text/javascript"></script>
<script type="text/javascript">
var myHubProxy = $.connection.hub.CreateHubProxy("MyHub");
myHubProxy.on('ClientsListener', function (msg) {
// alert to test
alert(' message from server');
//$("#messageDisplay").text(msg);
})
$.connection.hub.start().done(function () {
myHubProxy.Invoke('MyServiceFunction');
})
</script>
In Which my project not contains those scripts :
<script src="Scripts/jquery-1.6.4.min.js"type="text/javascript"></script>
<script src="Scripts/jquery.signalR-0.5.2.min.js"type="text/javascript"></script>
<script src="signalr/hubs" type="text/javascript"></script>
Please how can add the SignalR client library. I was try this : But I remarked no file clled Client_side library to add it .
In Solution Explorer, right-click the project, and select Add > Client-Side Library.
In the Add Client-Side Library dialog, for Provider select unpkg.
For Library, enter @aspnet/signalr@1
, and select the latest version that isn't preview.
Thanks in advance.
Install using Nuget, Go to Tools->Nuget -> Nuget Package manager Console and use the command below
Install-Package Microsoft.AspNetCore.SignalR
Note: This file <script src="signalr/hubs" type="text/javascript"></script> is automatically created, you would not find it in any folder.
If you want to install it using Library Manager (LibMan) to get the client library from unpkg
And you can easily add jQuery library, using Nuget or by adding jQuery cdn link.
Hi Vikas_jk I have Installed the package Microsoft.AspNetCore.SignalR .
But I can't find this file under my project This file <script src="signalr/hubs" type="text/javascript"></script>
Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly