Jump to content

Websockets and uniGUI


Farshad Mohajeri

Recommended Posts

  • Administrators

We are packing everything together and trying to release first uniGUI version supporting WebSockets.

In uniGUI, WebSockets technology is used to create a messaging system which enables developers to broadcast message instantly to all available sessions. This will help developers to eliminate the need to use a polling mechanism to update clients. Instead clients can be instantly updated when there is a change in server side data.

Estimated release date is January 2023.

 

  • Like 8
  • Thanks 1
  • Happy 2
  • Upvote 1
Link to comment
Share on other sites

  • Administrators
On 1/23/2023 at 2:10 AM, rgreat said:

Does that mean that you will replace numerous "HandleEvent" Client->Server  HTTP POST calls with Server->Client WebSocket messages?

It yes, that could definitely speed up GUI fluidity in many scenarios.

uniGUI core will not use WebSockets. uniGUI will use HTTP to handle Ajax requests as always. Websockets will be used to construct a messaging system which can be used by developers when needed.

Link to comment
Share on other sites

  • 3 weeks later...

AlwaysUseHTTP = True
http://unigui.com/doc/online_help/websockets--ssl.htm

If web page uses 
https then wss will be used for WebSocket connection. This behavior can be overrode by setting AlwaysUseHTTP property to True. In this case WebSockets will use a non-secure connection regardless of the web page.

I'm studying the WS, it will suggest several doubts, some may be childish. If my page is https, and I want to use WS as http by checking the AlwaysUseHTTP option, would that be allowed?


 

Link to comment
Share on other sites

Well, I'm trying to setup WS on a test server.

my current scenario

HTTPS page with CloudFlare

HyperServer with IIS

I don't have the SSL certificate (who makes the site https is cloudFlare)

So basically I need to use http websockets

Settings:
 

MainModule: 
  WebSocketConnection
    Enabled = True

ServerModule
  WebSocketServer:
    AlwaysUseHTTP = True
    AuxPort = 8088
    Binding = my ip server
    Enabled = True	
	
hyperserver cfg	
  [websockets]
  enabled=1
  aux_port=8088
  max_queue_length=1000
  binding=my ip server
  global_binding=
  global_port=0
  external_server_url=
  external_server_token=
  always_use_http=1

forgive me for not understanding the whole configuration

Link to comment
Share on other sites

Em 2/22/2023 às 11:22, picyka disse:

Bem, estou tentando configurar o WS em um servidor de teste.

meu cenário atual

Página HTTPS com CloudFlare

HyperServer com IIS

Eu não tenho o certificado SSL (quem faz o site https é cloudFlare)

Então, basicamente, eu preciso usar websockets http

Configurações:
 

MainModule: 
  WebSocketConnection
    Enabled = True

ServerModule
  WebSocketServer:
    AlwaysUseHTTP = True
    AuxPort = 8088
    Binding = my ip server
    Enabled = True	
	
hyperserver cfg	
  [websockets]
  enabled=1
  aux_port=8088
  max_queue_length=1000
  binding=my ip server
  global_binding=
  global_port=0
  external_server_url=
  external_server_token=
  always_use_http=1

perdoe-me por não entender toda a configuração

Does anyone know how to make it work in version 1565?

Link to comment
Share on other sites

  • Administrators
On 2/22/2023 at 5:22 PM, picyka said:

Well, I'm trying to setup WS on a test server.

my current scenario

HTTPS page with CloudFlare

HyperServer with IIS

I don't have the SSL certificate (who makes the site https is cloudFlare)

So basically I need to use http websockets

Settings:
 

MainModule: 
  WebSocketConnection
    Enabled = True

ServerModule
  WebSocketServer:
    AlwaysUseHTTP = True
    AuxPort = 8088
    Binding = my ip server
    Enabled = True	
	
hyperserver cfg	
  [websockets]
  enabled=1
  aux_port=8088
  max_queue_length=1000
  binding=my ip server
  global_binding=
  global_port=0
  external_server_url=
  external_server_token=
  always_use_http=1

forgive me for not understanding the whole configuration

There is no need to make settings in your application other than enabling MainModule.WebSocketsConnection.

Since you are using a different port, binding is not needed to be specified.

Above settings should work for you.

Link to comment
Share on other sites

42 minutes ago, Farshad Mohajeri said:

There is no need to make settings in your application other than enabling MainModule.WebSocketsConnection.

Since you are using a different port, binding is not needed to be specified.

Above settings should work for you.

Error without any configuration (image Error1)

Error with settings in serverModule(Image Error2)

Error1.png

Error2.png

Link to comment
Share on other sites

  • Administrators
3 hours ago, picyka said:

Return the same error.
If you want you can access my server through my computer.

Problem here is that you are using two different domains. One for regular website and other for websockets. If you use same domain or a subdomain for websockets then problem will be resolved.

for example:

Main domain: https://mywesapp.com

Websockets domain defined in GlobalBinding property: ws.mywesapp.com

Since both are under same domain browser will accept the connection.

Link to comment
Share on other sites

  • Administrators
16 minutes ago, Farshad Mohajeri said:

Problem here is that you are using two different domains. One for regular website and other for websockets. If you use same domain or a subdomain for websockets then problem will be resolved.

for example:

Main domain: https://mywesapp.com

Websockets domain defined in GlobalBinding property: ws.mywesapp.com

Since both are under same domain browser will accept the connection.

Problem seems to be different. Browser doesn't allow a non-secure connection on WS if your main site is on HTTPS.

It seems to be something that we have overlooked. You need to setup a secure websockets server.

Link to comment
Share on other sites

7 minutes ago, Farshad Mohajeri said:

Problem seems to be different. Browser doesn't allow a non-secure connection on WS if your main site is on HTTPS.

It seems to be something that we have overlooked. You need to setup a secure websockets server.

I sent the settings in private, maybe you can tell me what I did wrong thank you for your support.

Link to comment
Share on other sites

4 minutos atrás, Farshad Mohajeri disse:

O problema parece ser diferente. O navegador não permite uma conexão não segura no WS se o site principal estiver em HTTPS.

Parece ser algo que esquecemos. Você precisa configurar um servidor websockets seguro.

Now that I've seen this message.

Link to comment
Share on other sites

Hi team, Than is Very nice future :)

Just one question. 

If application is in HYPER-server (farm)  mode.

Will all sessions receive the broadcast message including those from the other nodes ?

Or If I send broadcast message from sessionID:ABCd2...  and it exists on Node 2 (for example)

Wiill (for example) SessionID:2321SD...  on Node 4  receive this message also.

 

Thanks  Kamen

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...