Skip to content

Commit

Permalink
added socketio
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelbannov committed Feb 24, 2022
1 parent 9d0f150 commit d4e4800
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
1 change: 1 addition & 0 deletions ASC.Web.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 4 additions & 2 deletions build/build.backend.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -25,6 +23,10 @@ for /R "scripts\" %%f in (*.bat) do (

echo.

call start\start.bat nopause

echo.

if "%1"=="nopause" goto end
pause

Expand Down
4 changes: 4 additions & 0 deletions build/run/SocketIO.bat
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions build/scripts/socketio.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yarn install --cwd %~dp0../../common/ASC.Socket.IO/ --frozen-lockfile
6 changes: 4 additions & 2 deletions common/services/ASC.Socket.IO.Svc/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

namespace ASC.Socket.IO.Svc
{
public class Program
public class Program
{
public async static Task Main(string[] args)
{
Expand Down Expand Up @@ -92,7 +92,9 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
})
.ConfigureServices((hostContext, services) =>
{
services.AddMemoryCache();
services.AddMemoryCache();
services.AddHttpClient();

var diHelper = new DIHelper(services);

var redisConfiguration = hostContext.Configuration.GetSection("Redis").Get<RedisConfiguration>();
Expand Down
8 changes: 7 additions & 1 deletion common/services/ASC.Socket.IO.Svc/SocketServiceLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ public Task StartAsync(CancellationToken cancellationToken)
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);
Expand All @@ -93,7 +99,7 @@ public Task StartAsync(CancellationToken cancellationToken)
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
};

Expand Down

0 comments on commit d4e4800

Please sign in to comment.