ravedadave Posted January 20 Posted January 20 Hi, I am using HyperServer for WebSockets in unigui a dedicated service. Say on port 8078 (https) I need to find an example of sending a broadcast outside of UniGUI...... is there any documentation for this, the end result will be I want to perform a call to the HyperServer from c# passing the data/token etc... which then broadcasts to all the clients........ Can someone provide documentation for this ? Thanks. Quote
Administrators Farshad Mohajeri Posted January 20 Administrators Posted January 20 Hi, For this you don't need to use websockets. Simply make a http call to the server and handle it in one of the nodes. (the persistent node preferably ) then broadcast the message to unigui sessions. Quote
andyhill Posted January 20 Posted January 20 On a slightly different tack. I am using CloudFlare to manage a UniGUI Server (it handles all SSL functionality) but now find that WebSockets no longer work. To me it appears to be a port issue. Has anyone dealt with this in the past ? Quote
picyka Posted January 22 Posted January 22 On 20/01/2026 at 15:42, andyhill said: Em uma abordagem um pouco diferente. Estou usando o CloudFlare para gerenciar um servidor UniGUI (ele gerencia toda a funcionalidade SSL), mas agora percebo que os WebSockets não funcionam mais. Para mim, parece ser um problema de porta. Alguém já passou por isso antes? Many people dream of running their web service with Cloudflare. Your web service needs to be WSS (Web Service Server) to receive website access. Quote
andyhill Posted January 22 Posted January 22 Not sure what you are saying, I have no issues running UniGUI Standalone Server on CloudFlare. Quote
andyhill Posted January 23 Posted January 23 Further investigation: UniGUI Server will not enable Websockets if UniGUI Server is not in SSL Mode on startup ! Farshad, one of the enticements to come over to CloudFlare is that ALL communication between the outside world and UniGUI Server is handled by CloudFlare's SSL routing, not by UniGUI Server - thus no more expensive local SSL certificates (we now use CloudFlare's certificate) - hooray. That means we run our UniGUI Server on IP 127.0.0.1 port 8xxx AND CloudFlare takes over by redirecting and Encrypting / Decrypting ALL outside traffic via their own SSL tunnel to our nominated port. Can we have a UniGUI Server option override to force Websockets to be enabled on port 8xxx with no UniGUI Server SSL please. Quote
andyhill Posted January 31 Posted January 31 Farshad, I know you are busy but it would help if you could acknowledge my problem and indicate if there will be a future solution ? Thanks in advance. Quote
Administrators Farshad Mohajeri Posted February 1 Administrators Posted February 1 18 hours ago, andyhill said: Farshad, I know you are busy but it would help if you could acknowledge my problem and indicate if there will be a future solution ? Thanks in advance. Hi Andy, What is your deployment method? Which method is used to enable Websockets? Quote
Administrators Farshad Mohajeri Posted February 1 Administrators Posted February 1 Have you enabled Websockets in cloudflare? https://developers.cloudflare.com/network/websockets/ Quote
andyhill Posted February 1 Posted February 1 Yes, but UniGUI Server will not enable WebSockets UNLESS SSL IS ENABLED WITHIN UNIGUI SERVER. Under CloudFlare we do not use UniGUI Server's SSL bindings. As stated earlier we need to enable WebSockets on UniGUI Server without SSL. Quote
Administrators Farshad Mohajeri Posted February 4 Administrators Posted February 4 On 2/1/2026 at 9:27 PM, andyhill said: Yes, but UniGUI Server will not enable WebSockets UNLESS SSL IS ENABLED WITHIN UNIGUI SERVER. Under CloudFlare we do not use UniGUI Server's SSL bindings. As stated earlier we need to enable WebSockets on UniGUI Server without SSL. OK. We will investigate this situation. Quote
Mossy Posted February 9 Posted February 9 Hi I have the same issue, I believe what is required that Unigui send "WSS" not "WS", I believe this will resolve the issue. I tried using JavaScript to change the "WS" to "WSS" but it looks that Unigui ignores and send "WS". If this is resolved it will be a massive help. Regards Quote
Mossy Posted February 11 Posted February 11 Hi Using Caddy, ssl works with Unigui App without any issue except the WebSocket. I believe, Caddy expect Unigui WebSocket to be prefixed with "WSS" not "WS" and ssl will work. Is it possible to have "WSS" prefix? Regards Quote
Mossy Posted February 13 Posted February 13 This is the error message we get ext-unicommon-min.js:9 Mixed Content: The page at 'https://xxxxx.xxxxx.portal.xxxx.co/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://xxxxx.xxxxx.portal.xxxx.co/uniWebSocket/_S_ID='apKzWChuBA11293C844'&_app='uniguift_exe''. This request has been blocked; this endpoint must be available over WSS. Unfortunately this is very critical on our project and has stopped our development. We have tried various JS and Caddy hacks with no results. We be very grateful if somehow this issue is resolved. Quote
Mossy Posted February 13 Posted February 13 If you have websocket ssl issue, use the following JS. Place it in a file and load it to customfiles. It is working with Caddy now. Farshad it would be very helpful if you have a look and see this is OK to use. UniServerModule.CustomFiles.Add('files/wsfix.js'); // wsfix.js (function () { if (window.__wsfix_installed) return; window.__wsfix_installed = true; // Only when the page is HTTPS if (location.protocol !== "https:") return; // Keep reference to the real WebSocket (avoid double-wrapping) var RealWebSocket = window.WebSocket; if (!RealWebSocket) return; window.WebSocket = function (url, protocols) { try { if (typeof url === "string" && url.indexOf("ws://") === 0) { url = "wss://" + url.substring(5); } } catch (e) {} // constructor behavior return protocols !== undefined ? new RealWebSocket(url, protocols) : new RealWebSocket(url); }; // preserve constants (OPEN, CLOSED, etc.) window.WebSocket.prototype = RealWebSocket.prototype; Object.keys(RealWebSocket).forEach(function (k) { try { window.WebSocket[k] = RealWebSocket[k]; } catch (e) {} }); })(); 1 Quote
Abaksoft Posted February 17 Posted February 17 5 hours ago, Mossy said: This is working with hyperserver too. Thank you so much Mossy ! Quote
andyhill Posted April 3 Posted April 3 Hi Farshad, Some time ago I mentioned that stand alone UniGUI applications will not engage WebSocket mode when they are not binding a SSL Certificate which makes sense if the application is handling SSL itself. BUT when run in a CloudFlare environment the UniGUI application must not engage SSL mode because CloudFlare looks after all http and https traffic (using their own SSL Certificate) removing the need for the application to have a SSL Certificate or run in SSL mode - the end result is that the application is fed the web stream to ONE IP and ONE PORT in either http or https (port switching is managed by CloudFlare and tunneled back to port 80 no matter what mode). Simply put we need the UniGUI application to enable WebSocket mode without the need of a SSL Certificate. You said "OK. We will investigate this situation" Has this been resolved ? Kind Regards Andy Quote
Administrators Farshad Mohajeri Posted April 4 Administrators Posted April 4 10 hours ago, andyhill said: Hi Farshad, Some time ago I mentioned that stand alone UniGUI applications will not engage WebSocket mode when they are not binding a SSL Certificate which makes sense if the application is handling SSL itself. BUT when run in a CloudFlare environment the UniGUI application must not engage SSL mode because CloudFlare looks after all http and https traffic (using their own SSL Certificate) removing the need for the application to have a SSL Certificate or run in SSL mode - the end result is that the application is fed the web stream to ONE IP and ONE PORT in either http or https (port switching is managed by CloudFlare and tunneled back to port 80 no matter what mode). Simply put we need the UniGUI application to enable WebSocket mode without the need of a SSL Certificate. You said "OK. We will investigate this situation" Has this been resolved ? Kind Regards Andy Hi, So let me understand the situation better. Your app runs behind cloudflare. Cloudflare handles https calls and redirect calls to your app using a http channel? What is your particular setup? Can you explain the exact way that cloudflare handles calls and directs them to your server? Quote
andyhill Posted April 5 Posted April 5 I have explained this as best I can. CloudFlare handles ALL traffic. This is my ServerModule UniGUIServerModuleBeforeInit Setup:- BindToIpStr:= '192.168.1.25'; // This is the Standalone UniGUI Server Bound IP on a Standalone PC with the NIC Bound IP HttpPort:= 80; // Bindings.BeginUpdate; Bindings.Clear; // Add Blank Binding (making sure it is valid entry where later we set Port/IP) with Bindings.Add do begin IP:= ''; Port:= 0; end; Bindings.EndUpdate; // Reference that added binding and set values if Bindings.Count > 0 then begin Bindings.Items[0].Port:= HttpPort; Bindings.Items[0].IP:= BindToIpStr; Bindings.Items[0].BroadcastEnabled:= True; end else begin Port:= HttpPort; // Default http end; CloudFlare communicates with the users browser in http and https mode irrespective of UniGUI mode. UniGUI Server sees only port 80 traffic after CloudFlare has encrypted / unencrypted web traffic stream. SO again I ask if we can enable the UniGUI Standalone Server WebSockets even if the ServerModule is not enabling SSL. I do not know how to say this any other way. Quote
Administrators Farshad Mohajeri Posted April 6 Administrators Posted April 6 You can enable websockets regardless of the HTTP or HTTPS prorocols. If the incoming traffic is HTTP then uniGUI will also listen to Websockets on non-secure ws:// protocol. If the incoming traffic is HTTPS then uniGUI will listen to Websockets on secure wss:// protocol. If you enable the option "AlwaysUseHTTP", then uniGUI will always listen on ws:// protocol regardless of the website protocol. Quote
LOGISTICASOFT Posted April 14 Posted April 14 On 1/20/2026 at 7:04 AM, Farshad Mohajeri said: Hi, For this you don't need to use websockets. Simply make a http call to the server and handle it in one of the nodes. (the persistent node preferably ) then broadcast the message to unigui sessions. Hello, could someone share an example of this solution in code? If this requires some notes, it would be important to receive them. Thank you 1 Quote
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.