Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
guru
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
guru
Commits
0c8e107a
Commit
0c8e107a
authored
Oct 17, 2018
by
Clint Mourlevat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding SignalR
parent
dcd92c50
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
0 deletions
+35
-0
UpdateHub.cs
Hubs/UpdateHub.cs
+13
-0
Startup.cs
Startup.cs
+8
-0
Stratis.Guru.csproj
Stratis.Guru.csproj
+1
-0
Index.cshtml
Views/Home/Index.cshtml
+8
-0
package-lock.json
package-lock.json
+5
-0
No files found.
Hubs/UpdateHub.cs
0 → 100644
View file @
0c8e107a
using
System.Threading.Tasks
;
using
Microsoft.AspNetCore.SignalR
;
namespace
Stratis.Guru.Hubs
{
public
class
UpdateHub
:
Hub
{
public
async
Task
SendMessage
(
string
user
,
string
message
)
{
await
Clients
.
All
.
SendAsync
(
"ReceiveMessage"
,
user
,
message
);
}
}
}
\ No newline at end of file
Startup.cs
View file @
0c8e107a
...
...
@@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Mvc;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.FileProviders
;
using
Stratis.Guru.Hubs
;
using
Stratis.Guru.Modules
;
using
Stratis.Guru.Services
;
...
...
@@ -48,6 +49,8 @@ namespace Stratis.Guru
services
.
AddHostedService
<
VanityService
>();
services
.
AddMvc
().
SetCompatibilityVersion
(
CompatibilityVersion
.
Version_2_1
);
services
.
AddSignalR
();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
...
...
@@ -76,6 +79,11 @@ namespace Stratis.Guru
RequestPath
=
"/npm"
});
app
.
UseSignalR
(
routes
=>
{
routes
.
MapHub
<
UpdateHub
>(
"/update"
);
});
app
.
UseMvc
(
routes
=>
{
routes
.
MapRoute
(
...
...
Stratis.Guru.csproj
View file @
0c8e107a
...
...
@@ -8,6 +8,7 @@
<PackageReference Include="BuildBundlerMinifier" Version="2.8.391" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.0.4" />
<PackageReference Include="NStratis" Version="4.0.0.34" />
<PackageReference Include="QRCoder" Version="1.3.3" />
<PackageReference Include="RestSharp" Version="106.5.4" />
...
...
Views/Home/Index.cshtml
View file @
0c8e107a
...
...
@@ -28,6 +28,14 @@
$(document).ready(function() {
var stratisPrice = @Model.UsdPrice;
var signalr = new signalR.HubConnectionBuilder().withUrl("/update").build();
signalr.on("ReceiveMessage", function (user, message) {
alert("ok");
});
signalr.start();
$(".click-edit").click(function() {
alert("ok");
})
...
...
package-lock.json
View file @
0c8e107a
...
...
@@ -4,6 +4,11 @@
"lockfileVersion"
:
1
,
"requires"
:
true
,
"dependencies"
:
{
"@aspnet/signalr"
:
{
"version"
:
"1.0.4"
,
"resolved"
:
"https://registry.npmjs.org/@aspnet/signalr/-/signalr-1.0.4.tgz"
,
"integrity"
:
"sha512-q7HMlTZPkZCa/0UclsXvEyqNirpjRfRuwhjEeADD1i6pqe0Yx5OwuCO7+Xsc6MNKR8vE1C9MyxnSj0SecvUbTA=="
},
"bootstrap"
:
{
"version"
:
"4.1.3"
,
"resolved"
:
"https://registry.npmjs.org/bootstrap/-/bootstrap-4.1.3.tgz"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment