mehmet07 Posted May 30, 2021 Share Posted May 30, 2021 Merhaba, Servermodule'un onHTTPCommand event'i ile disaridan gelen istekleri alabiliyorum. Bir istek geldiginde bu isteği tüm oturumlara nasil iletebilirim acaba? Servermodule istek geldiginde global bir degisken olusturup bu degiskenin degerini değiştirerek cozum buldum , ama bu durumda da main forma bir timer ekleyip surekli degiskenin degerinin değişip değişmedigini kontrol ettirmem gerekiyor. Servermodule den tüm oturumlarin mainformuna bildiri gecmek mumkun mudur? Teşekkürler. Quote Link to comment Share on other sites More sharing options...
Mehmet Emin Posted May 30, 2021 Share Posted May 30, 2021 Mehmet Bey Bu kod işinizi görür mü acaba başka bir thread'e cevap olarak yazmıştım test etmedim yanlız. if UniServerModule <> nil then begin if UniServerModule.SessionManager <> nil then begin if UniServerModule.SessionManager.Sessions.QuerySession(thesessionidfromdb) then begin LSession := UniServerModule.GetSession(thesessionidfromdb); UsersMainModule := TUniMainModule(LSession.UniApplication.UniMainModule); UsersMainModule.YourGameStateUpdated := True; end; end; Quote Link to comment Share on other sites More sharing options...
mehmet07 Posted May 30, 2021 Author Share Posted May 30, 2021 Merhaba, Öncelikle cevabınız için teşekkür ederim. Ne yapmak istedigimi detayli anlatayim isterseniz. Unigui uygulamami rest server gibi de kullaniyorum. Disaridan uygulamaya bir istek geldiginde ,istegin geldigine dair tum aktif oturumlari bilgilendirmek istiyorum. procedure TUniServerModule.UniGUIServerModuleHTTPCommand( ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo; var Handled: Boolean); begin if ARequestInfo.URI='/test' then begin Boylece her calisan uygulama gelen bu bilgiye gore islemler yapacak. Quote Link to comment Share on other sites More sharing options...
Mehmet Emin Posted May 30, 2021 Share Posted May 30, 2021 Doğru bir kod olmadı ancak UniServerModule.SessionManager.Sessions yazın ve bunun üzerinde dönebilirsiniz Quote Link to comment Share on other sites More sharing options...
Mehmet Emin Posted May 30, 2021 Share Posted May 30, 2021 SessionManager.Sessions.Lock; try for I := 0 to SessionManager.Sessions.SessionList.Count -1 do begin end; finally SessionManager.Sessions.Unlock; end; Quote Link to comment Share on other sites More sharing options...
mehmet07 Posted May 30, 2021 Author Share Posted May 30, 2021 Hmm, Tüm sessionslari dongu ile dolasip onlara istek gondermek şeklinde mi? Quote Link to comment Share on other sites More sharing options...
Mehmet Emin Posted May 30, 2021 Share Posted May 30, 2021 Evet try finally başında ve sonunda lock unlock var işinizi bir an önce bitirmeniz lazım tüm server'i kilitleyen bir kod Quote Link to comment Share on other sites More sharing options...
mehmet07 Posted May 30, 2021 Author Share Posted May 30, 2021 Anladim, çok teşekkür ederim. Deneyecegim. Quote Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted May 30, 2021 Share Posted May 30, 2021 Merhaba Tum sessionlari dolasip istek gonderseniz bile client tarafindan bir istek gelmedigi surece herhangi bir guncelleme olmayacaktir. Bu is icin en mantiklisi websocket kullanmak. Quote Link to comment Share on other sites More sharing options...
Mehmet Emin Posted May 30, 2021 Share Posted May 30, 2021 Doğru iş yine timer'a kalıyor. Önerim yanlış oldu. @Hayri ASLANşu websoketi uniGUI 2021 içinde biran önce direk destekleseniz çok güzel olacak. Quote Link to comment Share on other sites More sharing options...
mehmet07 Posted May 30, 2021 Author Share Posted May 30, 2021 Cevaplariniz icin tesekkur ederim Quote Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted May 30, 2021 Share Posted May 30, 2021 49 minutes ago, Mehmet Emin said: Doğru iş yine timer'a kalıyor. Önerim yanlış oldu. @Hayri ASLANşu websoketi uniGUI 2021 içinde biran önce direk destekleseniz çok güzel olacak. Merhaba Bunun için çalışıyoruz. Tek sorun server kısmı. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.