Skip to content

BlazorHub/oqtane.chathubs

 
 

Repository files navigation

Module

Asp .Net Core Blazor SignalR Entity Framework Core Chat Hub Template

The oqtane chathubs module allows developers to code and run realtime chat. Post issues anytime you want it is okay and appreciated i will reply as soon as im ready and fixed it anyhow.

Getting Started For Oqtane ChatHub Module Dev

  • Get familiar with the Oqtane Framework.
  • Clone the Oqtane Github Repository in Visual Studio Team Explorer.
  • Clone the Oqtane ChatHub Module in VS Team Explorer and build in debug and release mode.
  • get it work somehow good luck anyways

Edit _Host.cshtml end of head tag

<script src="_content/MatBlazor/dist/matBlazor.js"></script>
<link href="_content/MatBlazor/dist/matBlazor.css" rel="stylesheet" />
<link href="modules/oqtane.chathubs/chat-hub-stylesheets.css" rel="stylesheet" />

Edit _Host.cshtml end of body tag

<script async defer src="https://buttons.github.io/buttons.js"></script>
<script src="_content/BlazorStrap/blazorStrap.js"></script>
<script src="_content/BlazorTable/BlazorTable.min.js"></script>
<script src="modules/oqtane.chathubs/chat-hub-js-interop.js"></script>

Edit startup.cs configure services methode

services.AddScoped<VideoService, VideoService>();
services.AddScoped<BlazorAlertsService, BlazorAlertsService>();
services.AddScoped<BlazorDraggableListService, BlazorDraggableListService>();
services.AddScoped<BlazorFileUploadService, BlazorFileUploadService>();


services.AddMvc()
    .AddNewtonsoftJson(options => 
        options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore);

services.AddSignalR()
    .AddHubOptions<ChatHub>(options =>
    {
        options.EnableDetailedErrors = true;
        options.KeepAliveInterval = TimeSpan.FromSeconds(15);
        options.ClientTimeoutInterval = TimeSpan.FromMinutes(60);
        options.MaximumReceiveMessageSize = Int64.MaxValue;
        options.StreamBufferCapacity = Int32.MaxValue;
    })
    .AddMessagePackProtocol()
    .AddNewtonsoftJsonProtocol(options =>
    {
        options.PayloadSerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
    });

Edit startup.cs configure runtime pipeline

endpoints.MapHub<ChatHub>("/chathub", options =>
{
    options.Transports = HttpTransportType.WebSockets | HttpTransportType.LongPolling;
    options.ApplicationMaxBufferSize = Int64.MaxValue;
    options.TransportMaxBufferSize = Int64.MaxValue;
    options.WebSockets.CloseTimeout = TimeSpan.FromSeconds(10);
    options.LongPolling.PollTimeout = TimeSpan.FromSeconds(10);
});

Edit TenantResolver.cs

if (segments.Length > 1 && (segments[1] == "api" || segments[1] == "pages") && segments[0] != "~")
{
	aliasId = int.Parse(segments[0]);
}
else if (segments[0] == "chathub")
{
	aliasId = 1;
}

Module Dependencies so far

<dependency id="Oqtane.Framework" version="1.0.0" />      
<dependency id="System.Drawing.Common" version="5.0.0" />
<dependency id="MatBlazor" version="2.3.0" />
<dependency id="Microsoft.CSharp" version="4.7.0" />
<dependency id="BlazorStrap" version="1.3.3" />
<dependency id="Microsoft.AspNetCore.SignalR.Client" version="5.0.0" />
<dependency id="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" version="5.0.0" />
<dependency id="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" version="5.0.0" />
<dependency id="Microsoft.Composition" version="1.0.31" />

Example Screenshots

Demo Site

Demo Website Link.

Support our office

Anyways Corporation South Beach, San Francisco, California, USA

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 63.7%
  • HTML 25.3%
  • JavaScript 7.4%
  • TSQL 2.1%
  • Other 1.5%