mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-06-27 05:23:13 +00:00
AspNet
This commit is contained in:
@ -2,7 +2,7 @@ using Esiur.Core;
|
||||
using Esiur.Resource;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Esiur.ASPNet.Controllers
|
||||
namespace Esiur.AspNetCore.Example
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
|
@ -11,7 +11,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Esiur\Esiur.csproj" OutputItemType="Analyzer"/>
|
||||
<ProjectReference Include="..\Esiur.AspNetCore\Esiur.AspNetCore.csproj" />
|
||||
<ProjectReference Include="..\Esiur\Esiur.csproj" OutputItemType="Analyzer" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,6 +1,6 @@
|
||||
using Esiur.Resource;
|
||||
|
||||
namespace Esiur.ASPNet
|
||||
namespace Esiur.AspNetCore.Example
|
||||
{
|
||||
[Resource]
|
||||
public partial class MyResource
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Esiur.ASPNet;
|
||||
using Esiur.AspNetCore;
|
||||
using Esiur.AspNetCore.Example;
|
||||
using Esiur.Core;
|
||||
using Esiur.Net.IIP;
|
||||
using Esiur.Net.Sockets;
|
||||
@ -33,7 +34,7 @@ app.UseWebSockets(webSocketOptions);
|
||||
// Configure the HTTP request pipeline.
|
||||
//if (app.Environment.IsDevelopment())
|
||||
//{
|
||||
// app.UseSwagger();
|
||||
// app.UseSwagger();
|
||||
// app.UseSwaggerUI();
|
||||
//}
|
||||
|
||||
@ -50,26 +51,7 @@ var server = await Warehouse.Put("sys/server", new DistributedServer());
|
||||
|
||||
await Warehouse.Open();
|
||||
|
||||
app.Use(async (context, next) =>
|
||||
{
|
||||
var buffer = new ArraySegment<byte>(new byte[10240]);
|
||||
|
||||
if (context.WebSockets.IsWebSocketRequest)
|
||||
{
|
||||
var webSocket = await context.WebSockets.AcceptWebSocketAsync("iip");
|
||||
var socket = new FrameworkWebSocket(webSocket);
|
||||
var iipConnection = new DistributedConnection();
|
||||
server.Add(iipConnection);
|
||||
iipConnection.Assign(socket);
|
||||
socket.Begin();
|
||||
|
||||
while (webSocket.State == WebSocketState.Open) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
await next(context);
|
||||
}
|
||||
});
|
||||
app.UseEsiur(new EsiurOptions() { Server = server });
|
||||
|
||||
|
||||
await app.RunAsync();
|
||||
|
Reference in New Issue
Block a user