|
@@ -20,12 +20,14 @@ using Microsoft.AspNetCore.SpaServices;
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
using Microsoft.Extensions.Hosting;
|
|
|
+using Microsoft.Extensions.Primitives;
|
|
|
using Microsoft.IdentityModel.Tokens;
|
|
|
using TEAMModelOS.Models;
|
|
|
using TEAMModelOS.SDK;
|
|
|
using TEAMModelOS.SDK.Context.Attributes.Azure;
|
|
|
using TEAMModelOS.SDK.Context.Configuration;
|
|
|
using TEAMModelOS.SDK.DI;
|
|
|
+using TEAMModelOS.SDK.Extension;
|
|
|
using TEAMModelOS.SDK.Models.Service;
|
|
|
using VueCliMiddleware;
|
|
|
|
|
@@ -111,7 +113,35 @@ namespace TEAMModelOS
|
|
|
//注入word 標籤解析
|
|
|
string path = $"{ environment.ContentRootPath}/JsonFile/Core";
|
|
|
services.AddHtexTranslator(path);
|
|
|
- services.AddServerSentEvents();
|
|
|
+ services.AddServerSentEvents(o =>
|
|
|
+ {
|
|
|
+ o.KeepaliveMode = ServerSentEventsKeepaliveMode.Always;
|
|
|
+ o.OnClientConnected = async (service, client) =>
|
|
|
+ {
|
|
|
+ //if (client.Request.Headers.TryGetValue("X-Auth-Name", out StringValues name))
|
|
|
+ //{
|
|
|
+ // client.Client.SetProperty("NAME", name.ToString());
|
|
|
+ //}
|
|
|
+ //if (client.Request.Headers.TryGetValue("X-Auth-DID", out StringValues did))
|
|
|
+ //{
|
|
|
+ // client.Client.SetProperty("DID", did.ToString());
|
|
|
+ //}
|
|
|
+ //if (client.Request.Headers.TryGetValue("X-Auth-CID", out StringValues cid))
|
|
|
+ //{
|
|
|
+ // client.Client.SetProperty("CID", cid.ToString());
|
|
|
+ //}
|
|
|
+ //if (client.Request.Headers.TryGetValue("X-Auth-PIN", out StringValues pin))
|
|
|
+ //{
|
|
|
+ // client.Client.SetProperty("PIN", pin.ToString());
|
|
|
+ //}
|
|
|
+ //if (client.Request.Headers.TryGetValue("X-Auth-APP", out StringValues app))
|
|
|
+ //{
|
|
|
+ // client.Client.SetProperty("APP", app.ToString());
|
|
|
+ //}
|
|
|
+
|
|
|
+ await client.Client.SendEventAsync(new { sid = client.Client.Id.ToString() }.ToJsonString());
|
|
|
+ };
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|