Wisej WebSocket (not always) working

Answered
0
0

Hey there,

I have two website applications under the same Web page. Both uses the same Default.json file, with enableWebSocket true. Both websites needs to be refreshed frequently. For one website Application.IsWebsocket returns true, while on the website it returns false. The one not working got installed later. I am opening those websites from the server (localhost), same browser. I can’t figure out the problem alone, please help me!

  • You must to post comments
Best Answer
1
0

If you run code in a thread you must call Application.Update(). Browsers only receive a response if there is a request. WebSocket allows for a push update, which requires a push.

If Application.Update() works then it’s using WebSocket.

If you check Application.IsWebSocket in Program.Main it will always be false since the first request is always http.

HTH

 

 

  • You must to post comments
0
0

So here is my setup:

  • IIS installed on server 2019
  • One “Default Website” on that server.
  • One appliaction which was made with an earlier version of Wisej.
  • One application which was made with a newer version of Wisej (not sure how to check it).
  • The earlier website can run a simple clock (i.e), it updates every second.
  • The newer website seems to refresh only 5-20 seconds, here, also Application.IsWebsocket returns false.
  • The server has Web Socket installed on the IIS.
  • The code for both is quite simple:

Dim x As Integer = 2
Do
Invoke(Sub()
PanelContentContainer.Controls.Clear()
PanelContentContainer.Controls.Add(ShownPanelList(x))
End Sub)
ElaspedSeconds= 0
Do While ElaspedSeconds< ChangeSeconds
ElaspedSeconds+= 1
Invoke(Sub()
ProgressCircle1.Value = Math.Floor((ElaspedSeconds/ ChangeSeconds) * 100)
LabelTime.Text = Now.ToLongDateString & ” ” & Now.ToLongTimeString
End Sub)
Threading.Thread.Sleep(1000)
Loop
If x<> ShownPanelList.Count – 1 Then
x+= 1
Else
x= 0
End If
Loop

Edit 1#: This sub is inside a Thread.

Edit 2#: Adding Application.Update(Me) after setting the Invoke which sets the time seems to solve this issue, but still it’s not running in websocket mode.

  • You must to post comments
0
0

Hi László,

I’m not sure I fully understand your setup. Can you please attach a small sample replicating the issue?

Best,

Levie

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.