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"];