B4J Question [BANano/BANanoServer] Explaining WebSockets Secure Development & Deployment for Dummies

Mashiane

Expert
Licensed User
Longtime User
Ola

Some background. When I first deployed my first ABM application, I compiled it, took some contents of the "Objects" folder, gave it to our ISP. He provided me a URL to access the WebApp and I was good to go. That is still running today. As I follow Alain, when he twitted this, it felt so natural because that is what I have been used to, even with the PHP deployments I have done. You just upload the files and everything works and it really does.

1635326106427.png


Then I got stuck... and I know I'm definitely not doing something right and yes, lack of knowledge.

Perhaps a look behind the scenes of a perfectly done deployment.

If we look back at "what happens behind the scenes", the story becomes very complex for me, especially for people who know nothing about SLL, WebSocket secure etc. The deployments for Windows and Linux work differently. I want to be a front man to know all these nitty gritties etc without having to just provide the executable/source but go beyong the "behind the scenes"

I've read about SSL and creating keystroke files will try and create one today. I work and develop in Windows and I've seen many posts where people try to run B4X in Linux using Wine etc etc, still B4X development was meant for Windows development. However when it comes to deploying websites, most scenarios are for Linux machines. Interesting fact. Develop on Windows, now go to Linux and type some command that starts with "sudo" what what... phew. I have so much to learn!

Anyway. I need help. On the development side towards deployment and now not having to give this to an ISP but to individuals like me who just want a working app. "You know what, Ive never done that actually and I don't know". OMG, what a quick way to loose potential clients. But then again, we have a forum and I can always get help.

I am assuming that towards WebSockets secure, one needs to change the BANanoServer template a bit.

Q1.

B4X:
'Initializes the object. You can NOT add extra parameters!
Public Sub Initialize
    'Log("BrowserIndex initialize")
    ' does the browser support websockets?
    If ws.IsSupported Then
        ' here we connect to our SERVERIndex websocket class using the 'classic' B4J Websocket events WebSocket_Connected and WebSocket_Disconnected
        ws.Initialize("ws://" & BANano.Location.GetHost & "/ws/" & BANano.StaticFolder & "/index")
    End If
End Sub

Perhaps change ws.initialize("ws://") to ws.initialize("wss://") - is this correct?

Q2.

Do I change anything on this line?

B4X:
Server.AddWebSocket("/ws/" & Server.BANano.StaticFolder & "/index" , "SERVERIndex")

Q3.

Erel gave a response to someone to

You need to set WebSocket.SkipCertificateValidation to True.

They had issues connecting to Websokcet from B4i, how relevant is this to BANanoServer for b4i & b4a apps, talking to BANanoServer?

Q4.

I have gone through this post


I am assuming some of these are done internally, as one has to do this on BANanoServer

B4X:
' lets start the B4J server
    If Server.PortSSL <> 0 Then
        Server.StartServerHTTP2("keystore.jks", "SSLKeyStorePassword", "SSLKeyManagerPassword")
    Else
        Server.StartServer
    End If

Will try and create a keystroke file etc today and explore.

Thanks
 
Top