swapping to webview webrtc setup as temp solution
will build a custom C# webrtc implementation later
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using System.Text.Json;
|
||||
using RelayServer.Services;
|
||||
using WebSocketSharp.Server;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using RelayServer.Models;
|
||||
|
||||
var surrealService = new SurrealService();
|
||||
@@ -12,6 +14,14 @@ await using var db = await surrealService.ConnectAsync();
|
||||
ChatTest.ClientKeyService = new ClientKeyService(db);
|
||||
ChatTest.Db = db;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddSignalR();
|
||||
|
||||
var app = builder.Build();
|
||||
app.MapGet("/", () => "Server Running!");
|
||||
app.MapHub<WebRtcHub>("/webrtc");
|
||||
app.Run();
|
||||
|
||||
var wssv = new WebSocketServer("ws://localhost:1337");
|
||||
wssv.AddWebSocketService<ChatTest>("/");
|
||||
wssv.Start();
|
||||
@@ -146,4 +156,25 @@ static string GetRecordId(object? id)
|
||||
var table = root.GetProperty("Table").GetString() ?? string.Empty;
|
||||
|
||||
return $"{table}:{recordId}";
|
||||
}
|
||||
|
||||
public class WebRtcHub : Hub
|
||||
{
|
||||
public async Task SendOffer(string targetConnectionId, string sdp)
|
||||
{
|
||||
await Clients.Client(targetConnectionId)
|
||||
.SendAsync("ReceiveOffer", Context.ConnectionId, sdp);
|
||||
}
|
||||
|
||||
public async Task SendAnswer(string targetConnectionId, string sdp)
|
||||
{
|
||||
await Clients.Client(targetConnectionId)
|
||||
.SendAsync("ReceiveAnswer", Context.ConnectionId, sdp);
|
||||
}
|
||||
|
||||
public async Task SendIceCandidate(string targetConnectionId, string candidate)
|
||||
{
|
||||
await Clients.Client(targetConnectionId)
|
||||
.SendAsync("ReceiveIceCandidate", Context.ConnectionId, candidate);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
@@ -8,6 +8,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.2.9" />
|
||||
<PackageReference Include="SurrealDb.Net" Version="0.9.0" />
|
||||
<PackageReference Include="WebSocketSharp" Version="1.0.3-rc11" />
|
||||
</ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user