B4R Question web socket change to ssl and stoped working

yaniv hanya

Active Member
Licensed User
Hello,

I used b4r web socket to connect to a web socket I built. And it worked fine. Now the site default connection changed to https, and I try to use it, but it is not working. I get "connected" message and shortly "disconnected".

This is the log-

connecting to web socket
/goodHome.ashx
Connected
switch color on-5
disconnected

I didn’t change any thing in the ws connection sub.
It was-
B4X:
If wsc.ConnectHost(st.Socket.Stream,"www.thingstoknow.co.il",80,theURL) Then

Log("connected")

Main.turnWifiLedON

Else

Log("problem")

Main.turnWifiLedOff

End If

And I changed it to-
B4X:
If wsc.ConnectHost(st.Socket.Stream,"www.thingstoknow.co.il",443,theURL) Then

Log("connected")

Main.turnWifiLedON

Else

Log("problem")

Main.turnWifiLedOff

End If

only the port changed.
Should I do something else?
 

drgottjr

Expert
Licensed User
Longtime User
you may have to check the http(s) server's configuration. i assume you are using a web server to accept
connections and then pass them to a websockets server, yes? if no, ignore the rest of this post.

i have servers running nginx and apache. both can proxy my websockets server. but both must
be configured to handle http and https separately. if you only configured http, you have to do the same thing for https connections.
look carefully at how your server handles http and https when client is looking for websockets. you can usually just copy and paste
from http to https. it looks like you may be using IIS; i don't know how its configuration works.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
did you read anything else? or just the part about IIS? either the server configuration needs to be changed or the websocket server needs to be configured differently. how does IIS proxy the call to the websocket server?
 
Upvote 0
Top