|
Forum Index : Microcontroller and PC projects : BasicBasic Visual Designer Studio
| Author | Message | ||||
| Batteryman Regular Member Joined: 05/04/2016 Location: United KingdomPosts: 57 |
Hi I'll continue the BBVDS using this new topic: Just to see the web socket working on in brave using BBVDS Download this: Web-Socket_Test_Brave_.vbproj.json.zip If this works, then try this example for your project: Web-Socket_Test_Andoid_.vbproj.json.zip Peter |
||||
| Batteryman Regular Member Joined: 05/04/2016 Location: United KingdomPosts: 57 |
BASICBasic Visual Designer Studio Sorry I forgot to send you the link tom_g Peter |
||||
| tom_g Regular Member Joined: 21/02/2023 Location: SwitzerlandPosts: 47 |
Peter, thanks a lot for the provided files. WS between BBVDS and websocket.org works. WS between BBVDS and "socket tool" test app: I do not get to work the ws server from the test app ("socket tool" by Star Soft) Setup of ws in the test server: binding IP 127.0.0.1 (localhost) on port 8080 I am unshure how to define the web socket path of the server (I used ws://127.0.0.1) Can you please give me a last hint ? (I will not continue to bother you after this last request, as I really do not have enough knowledge in this domain ...) Thank you, and with best regards: Thomas |
||||
| Batteryman Regular Member Joined: 05/04/2016 Location: United KingdomPosts: 57 |
Hi tom_g Ok, we shall give up yet...! The fact that wss://echo.websocket.org worked is a major breakthrough: it proves that BasicBasicVDS, your Socket control, and Brave’s WebSocket engine on your tablet are all 100% operational. So the main focus is on the Star Soft app i think? You may have this all setup correctly, but just a check! 1. The usual check for "Path" Mistake in Socket Tool (Server Setup) In your WebSocket server apps (Star Soft): The "Path" field in the server setup must be just / (a single forward slash) or left blank. By entering ws://127.0.0.1 into the path field, the server was listening on ws://127.0.0.1:8080/ws://127.0.0.1. When BasicBasic tried to connect to ws://127.0.0.1:8080/, the handshake was rejected with a 404/Bad Request. Correct "Socket Tool" Server Settings: Role / Mode: WebSocket Server Binding IP: 0.0.0.0 (binds to all interfaces, which is much more reliable on Android than 127.0.0.1) or 127.0.0.1 Port: 8080 Path / URI: / (just a single slash) Tap Start / Listen in Socket Tool. 2. The HTTPS → ws:// Mixed-Content Blocker in Brave This is why wss://echo.websocket.org worked but ws://127.0.0.1 failed: echo.websocket.org uses wss:// (encrypted SSL/TLS), so Brave allows it without hesitation. 127.0.0.1 uses ws:// (unencrypted plain text). Because BasicBasicVDS is running over HTTPS, Brave strictly blocks unencrypted background connections by default for security. If this happens, your Socket1.LastError in BasicBasic will report: "This page is secure (https), so the browser blocks plain ws:// links. Use wss:// or the desktop app." How you can fix this in Brave on Android: Tap the Brave Shields (lion icon) in the address bar while on BBVDS site → turn Shields OFF for the site. Tap the padlock / tune icon in the address bar → Permissions / Site settings → change Insecure content (or "Mixed content") to Allow. Reload the BasicBasic page. Ohin the Button1.Action editor: ' Button1.Action (Connect) Socket1.Host = "127.0.0.1" Socket1.Port = 8080 Socket1.Protocol = "WebSocket" Label1.Text = "Connecting to local tool..." Socket1.Connect (Note: If Socket Tool is bound to a specific path like /ws, you can simply set Socket1.Host = "127.0.0.1/ws"). And in Socket1.Error: Label1.Text = "Error: " & Socket1.LastError This error label will immediately tell you if Brave is blocking the connection or if the port was refused. I'm happy to keep going until we get to the point where Brave has a vulnerability security issue, which in today's climate is quite understandable! I can update the my file here and upload in the next post for the above VB suggestions Peter |
||||
| tom_g Regular Member Joined: 21/02/2023 Location: SwitzerlandPosts: 47 |
Good evening Peter, I am sorry, still no success. I did follow all the steps you have described so well, but simply get the "Error: Could not connect to ws://127.0.0.1:8080" in BBVDS as socket last error notification. Maybe an issue with Socket tool ? And as you mentioned, I am afraid from consequences due to lowering safety margins in Brave browser. I am sorry, spent too much time and have to give it up now ... As you have explained the behaviour I have learnt quite a bit about web sockets topic and want to thank you very much for your help and patience. Let me express my respect for your knowledge and work, with my best wishes Thomas |
||||
| Batteryman Regular Member Joined: 05/04/2016 Location: United KingdomPosts: 57 |
Hi Thomas, It's been a pleasure to look into this for you, I'll keep looking into it myself as a challenge! Just a quick question, are you using this Web socket tool for other projects that work OK? If so give me details if your happy to. If I do get it working on my side using Star Soft then I'll post it here and add to help guide. Hopefully you will keep an eye on here to pick it up. Best regards Peter |
||||
| tom_g Regular Member Joined: 21/02/2023 Location: SwitzerlandPosts: 47 |
Peter, I can finally report success with websocket connection between BBVDS websock client, through Brave browser and external app "Socket Tool" set up as web socket server on my Android S6 tablet. Your hints were valuable, in addition I had to dig more into Brave: For the site https://basicbasicvds.prontogwyn.site/ the global shield can be left enabled. In brave (setup - website setup) I allowed for the referred site 1. access to USB 2. serial 3. network 4. apps on device Remains to find out, which of these settings are vital for transprency. With these settings I repeated the test for web serial with Brave - no success, pity. So I am now looking for a solution with a simple websocket-to-USB or -TCP bridge. Not yet found a suitable app - maybe someone on the forum knows one ? Add on: only allowance 4. (apps on device) is vital for transparency for localhost Thanks again and best regards: Thomas Edited 2026-12-04 21:39 by tom_g |
||||
| Batteryman Regular Member Joined: 05/04/2016 Location: United KingdomPosts: 57 |
Hi Thomas, Well is that's good news, so the web socket is working, but the web serial is still not? could you try (if you have not previously) https://basicbasicvds.prontogwyn.site/ the global shield set to disabled. Just see if that is the web serial issue. Thanks for letting me know Peter |
||||
| tom_g Regular Member Joined: 21/02/2023 Location: SwitzerlandPosts: 47 |
Hi Peter, I tried again without luck: the CP2102 HW interface is not listed in the pop up panel. ![]() Best: Thomas |
||||
| Batteryman Regular Member Joined: 05/04/2016 Location: United KingdomPosts: 57 |
Hi Thomas, That's interesting that does not see your CP2102, I know this may sound strange, can you check if anything else (COM PORTS) are accessing the device! I'll have you used Brave for web serial before with other devices or this one? I ask these questions to help me solve the issue! Thanks for the screen shot. Peter |
||||
| Batteryman Regular Member Joined: 05/04/2016 Location: United KingdomPosts: 57 |
Hi Thomas I checked more for USB use on Android: The finding that Brave's "Apps on device" permission is the key toggle for localhost access is extremely helpful for anyone running local services on Android. Regarding your screenshot: it is in German and i translated in Google, it reads: "https://basicbasicvds.prontogwyn.site wants to connect to a serial port: No compatible devices found." This confirms that the Web Serial API was triggered in Brave, but because Chromium on Android lacks the built-in userland USB-to-UART drivers (like CP210x/FTDI), the browser's device picker remains empty. Your idea of a USB-to-WebSocket bridge app is the right solution! A ready-made app for this on the Google Play Store is: "OTG USB Serial2Websocket" (by Devitica Software, package: com.wh00hw.serial2websocket). How to set it up: 1. Plug your CP2102 into the S6 via USB OTG. 2. Open "OTG USB Serial2Websocket" and grant Android USB access. 3. Choose your baud rate (e.g. 115200), set Port (e.g. 8080), and bind to 127.0.0.1. 4. Tap Start. 5. In BasicBasicVDS, use the Socket control: Socket1.Host = "127.0.0.1" Socket1.Port = 8080 Socket1.Protocol = "WebSocket" Socket1.Connect Once connected, Socket1.Send transmits data out of your CP2102, and incoming serial bytes will trigger Socket1.DataReceived. Peter |
||||
| tom_g Regular Member Joined: 21/02/2023 Location: SwitzerlandPosts: 47 |
Hi Peter, thanks for the posts. WebSerial, CP2102 drivers: No COM is busy in the background. But I am not sure if actually Brave does support WebSerial. "OTG USB Serial2Websocket" app : I tried to install the APK, no luck, it begins the install but does not come to an end of the installing process, seems to be a very early and outdated app ... So the search for another serial-to-websockets app goes on. Any more hints very welcome. For today, have a good evening and with best regards: Thomas |
||||
| Batteryman Regular Member Joined: 05/04/2016 Location: United KingdomPosts: 57 |
Hi Thomas, Thanks for testing that out! The reason that APK stalled during installation is that your Tab S6 Lite is running modern Android 13. Recent Android versions block or fail to install legacy 32-bit APKs that target older Android SDK versions (Android 5–8) due to modern security and permission restrictions. Here are a few modern, actively maintained options to consider: 1. Termux + websocat (The Most Reliable Local Bridge on Android 13) If you have Termux installed (from F-Droid): It can run a local WebSocket-to-USB bridge in seconds: pkg install websocat Or a 5-line Python script using pyserial + websockets. Because Termux runs natively on Android 13, it doesn't get blocked by legacy installer checks and can bridge the USB port directly to ws://127.0.0.1:8080. 2. TCP-UART Bridge Apps: There are several active apps on Google Play that bridge USB-to-TCP (such as "TCP UART" or "Serial to TCP"). Note: Inside a web browser like Brave, web security requires WebSocket framing rather than raw TCP. If you export the BasicBasic project as a standalone app, the Socket control handles raw TCP directly, but in-browser it requires a WebSocket handshake. 3. "SerialBridge" on GitHub (Targeted for Android Chromium): There is an open-source project called SerialBridge (built with usb-serial-for-android) specifically created to serve a local WebSocket on ws://127.0.0.1:8765 for browsers that lack native WebSerial USB drivers. It compiles against modern Android SDKs. Have a good weekend Best regards, Peter |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |