From bfc5b6a9748ffff53385074ef577e783d9661147 Mon Sep 17 00:00:00 2001 From: AlanMoonbase Date: Tue, 18 Mar 2025 13:44:01 -0700 Subject: [PATCH] add log message that says a restart to the api is required to reestablish connection with mmo --- src/Services/MMOClientService.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Services/MMOClientService.cs b/src/Services/MMOClientService.cs index a51a9ac..6691db5 100644 --- a/src/Services/MMOClientService.cs +++ b/src/Services/MMOClientService.cs @@ -45,12 +45,14 @@ public class MMOClientService : IHostedService SFSClient.Connect(SFSConfig); SFSClient.AddEventListener(SFSEvent.CONNECTION, OnConnectionEstablished); + SFSClient.AddEventListener(SFSEvent.CONNECTION_LOST, OnConnectionLost); SFSClient.AddEventListener(SFSEvent.LOGIN, OnLogin); // return completed task (SmartFox seems to be completely synchronous) return Task.CompletedTask; } + public Task SetRoomVarForRoom(int roomId, RoomVariable var) { if (IsLoggedIn) @@ -100,6 +102,12 @@ public class MMOClientService : IHostedService } } + private void OnConnectionLost(BaseEvent evt) + { + Console.WriteLine($"Connection To The MMO Server Was Lost. Reason - {(string)evt.Params["reason"]}"); + Console.WriteLine("MMO Service Currently Not Ready.\nThis Required A Full API Restart For Realtime Communication To Be Reestablished."); + } + private void OnLogin(BaseEvent evt) { CurrentUser = (User)evt.Params["user"];