added socketio

This commit is contained in:
pavelbannov 2022-02-24 13:47:18 +03:00
parent 9d0f1500e6
commit d4e48004bc
6 changed files with 21 additions and 5 deletions

View File

@ -22,6 +22,7 @@
"common\\services\\ASC.ElasticSearch\\ASC.ElasticSearch.csproj",
"common\\services\\ASC.Feed.Aggregator\\ASC.Feed.Aggregator.csproj",
"common\\services\\ASC.Notify\\ASC.Notify.csproj",
"common\\services\\ASC.Socket.IO.Svc\\ASC.Socket.IO.Svc.csproj",
"common\\services\\ASC.Studio.Notify\\ASC.Studio.Notify.csproj",
"common\\services\\ASC.TelegramService\\ASC.TelegramService.csproj",
"common\\services\\ASC.UrlShortener.Svc\\ASC.UrlShortener.Svc.csproj",

View File

@ -11,8 +11,6 @@ call start\stop.bat nopause
dotnet build ..\asc.web.slnf /fl1 /flp1:logfile=asc.web.log;verbosity=normal
echo.
call start\start.bat nopause
echo install nodejs projects dependencies...
echo.
@ -25,6 +23,10 @@ for /R "scripts\" %%f in (*.bat) do (
echo.
call start\start.bat nopause
echo.
if "%1"=="nopause" goto end
pause

4
build/run/SocketIO.bat Normal file
View File

@ -0,0 +1,4 @@
@echo off
PUSHD %~dp0..\..
set servicepath=%cd%\common\services\ASC.Socket.IO.Svc\bin\Debug\ASC.Socket.IO.Svc.exe urls=http://0.0.0.0:5028 $STORAGE_ROOT=%cd%\Data log:dir=%cd%\Logs log:name=socketio pathToConf=%cd%\config core:products:folder=%cd%\products core:products:subfolder=server socket:path=%cd%\common\ASC.Socket.IO

View File

@ -0,0 +1 @@
yarn install --cwd %~dp0../../common/ASC.Socket.IO/ --frozen-lockfile

View File

@ -47,7 +47,7 @@ using StackExchange.Redis.Extensions.Newtonsoft;
namespace ASC.Socket.IO.Svc
{
public class Program
public class Program
{
public async static Task Main(string[] args)
{
@ -92,7 +92,9 @@ public class Program
})
.ConfigureServices((hostContext, services) =>
{
services.AddMemoryCache();
services.AddMemoryCache();
services.AddHttpClient();
var diHelper = new DIHelper(services);
var redisConfiguration = hostContext.Configuration.GetSection("Redis").Get<RedisConfiguration>();

View File

@ -83,6 +83,12 @@ namespace ASC.Socket.IO.Svc
try
{
var settings = ConfigurationExtension.GetSetting<SocketSettings>("socket");
var path = settings.Path;
if (!Path.IsPathRooted(settings.Path))
{
path = Path.GetFullPath(CrossPlatform.PathCombine(HostEnvironment.ContentRootPath, settings.Path));
}
PingInterval = settings.PingInterval.GetValueOrDefault(10000);
ReconnectAttempts = settings.ReconnectAttempts.GetValueOrDefault(5);
@ -93,7 +99,7 @@ namespace ASC.Socket.IO.Svc
UseShellExecute = false,
FileName = "node",
WindowStyle = ProcessWindowStyle.Hidden,
Arguments = $"\"{Path.GetFullPath(CrossPlatform.PathCombine(HostEnvironment.ContentRootPath, settings.Path, "server.js"))}\"",
Arguments = $"\"{Path.Combine(path, "server.js")}\"",
WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory
};