tufanv Expert Licensed User Longtime User Jan 13, 2021 #1 Hello, I have a websocket project built in b4j. Main sub gets json data from my server via a php file every half second for the latest values of financial data when jobdone timer is enabled again, and websocket module broadcasts this data to connected clients. in websocket module I get the json response of main module and use jsonparser to get each data and distribute requested pairs to client I have a strange problem. There is no problem with the websocket module, it works flawless. But I tried 4 times, Every time after 1 hour and 40 minutes, data taken from the php file startes not to change, so the distibuted data is also not changing. I dont see any problem on http request side. I have logging system on job error but no error triggers. No other logs. If I stop the server and restart again on my server, everything works fine again until 1 hour 40 minutes again. Here is how i get data with okhttputils: B4X: timeral.Initialize("timeral",500) timeral.Enabled=True B4X: Sub timeral_tick timeral.Enabled=False verial End Sub B4X: Sub verial ' timerping.Enabled=True Dim j As HttpJob j.Initialize("verial",Me) j.Download("https://xxx.com/getdata.php") j.GetRequest.Timeout=3500 j.release End Sub B4X: Sub JobDone (Job As HttpJob) If Job.JobName="verial" Then If Job.Success=True Then veriler=Job.GetString timeral.Enabled=True Else timeral.Enabled=True Log("Error: "&Job.ErrorMessage) End If End If end sub and on websocket side i get this data with B4X: Dim parser As JSONParser parser.Initialize(Main.veriler) what may be the reason it always start to send same data after same mount of time where possibly getting the data from php fails somehow so same data is delievered to clients every time. It is driving me crazy Thanks
Hello, I have a websocket project built in b4j. Main sub gets json data from my server via a php file every half second for the latest values of financial data when jobdone timer is enabled again, and websocket module broadcasts this data to connected clients. in websocket module I get the json response of main module and use jsonparser to get each data and distribute requested pairs to client I have a strange problem. There is no problem with the websocket module, it works flawless. But I tried 4 times, Every time after 1 hour and 40 minutes, data taken from the php file startes not to change, so the distibuted data is also not changing. I dont see any problem on http request side. I have logging system on job error but no error triggers. No other logs. If I stop the server and restart again on my server, everything works fine again until 1 hour 40 minutes again. Here is how i get data with okhttputils: B4X: timeral.Initialize("timeral",500) timeral.Enabled=True B4X: Sub timeral_tick timeral.Enabled=False verial End Sub B4X: Sub verial ' timerping.Enabled=True Dim j As HttpJob j.Initialize("verial",Me) j.Download("https://xxx.com/getdata.php") j.GetRequest.Timeout=3500 j.release End Sub B4X: Sub JobDone (Job As HttpJob) If Job.JobName="verial" Then If Job.Success=True Then veriler=Job.GetString timeral.Enabled=True Else timeral.Enabled=True Log("Error: "&Job.ErrorMessage) End If End If end sub and on websocket side i get this data with B4X: Dim parser As JSONParser parser.Initialize(Main.veriler) what may be the reason it always start to send same data after same mount of time where possibly getting the data from php fails somehow so same data is delievered to clients every time. It is driving me crazy Thanks
tufanv Expert Licensed User Longtime User Jan 13, 2021 #2 I was not using this: https://www.b4x.com/android/forum/threads/server-jokhttputils2-server-version.124350/ I will try with this, can it be the problem ? Upvote 0
I was not using this: https://www.b4x.com/android/forum/threads/server-jokhttputils2-server-version.124350/ I will try with this, can it be the problem ?
tufanv Expert Licensed User Longtime User Jan 13, 2021 #3 tufanv said: I was not using this: https://www.b4x.com/android/forum/threads/server-jokhttputils2-server-version.124350/ I will try with this, can it be the problem ? Click to expand... it seems that this fixed the problem. Upvote 0
tufanv said: I was not using this: https://www.b4x.com/android/forum/threads/server-jokhttputils2-server-version.124350/ I will try with this, can it be the problem ? Click to expand... it seems that this fixed the problem.