HTML5 endpoint must be available over WSS

jaber

Member
Hello,
sofar my HTML game connects to a Windows server I hosted it on aws

GML:
//////////////////////// Create socket and connect to server
global.socket = network_create_socket(network_socket_ws);
ip = "18.xx.xx.xx";
global.isConnected = network_connect(global.socket, ip, 9000);

if(global.isConnected < 0)
    show_error("Could not connect to server! check your Internet connection", true);
everything worked fine untill I secured the website with SSL and used https; now its not connecting any more to the server and I am getting this error when I load the game

"The page at 'https://wanasa.world/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://"18.xx.xx.xx":9000/'. This request has been blocked; this endpoint must be available over WSS."

I undersrand that I should use wss. but to get the request work over https... but I dont know how :/ can any one guide me how/what to do?
very much appreciated
J
 
Last edited:

jaber

Member
GML:
ip = "wss://18.xx.xx.xx";
global.isConnected = network_connect(global.socket, ip, 9000);
i have changed to ip = "wss://18.xx.xx.xx"; now I am getting new error

GML:
WebSocket connection to 'wss://18.xx.xx.xx:9000/' failed: Error in connection establishment: net::ERR_CONNECTION_CLOSED
should I do changes from the server side or open some additional ports?
cheers
J
 

jaber

Member
I have to mention this output from my backend Gamemaker server
1603005302590.png

I can understand that the server is expecting HTTP request and thats why he is refusing! any advice?
thnx
 

jaber

Member
Try network_connect_raw instead of network_connect if the server end is not written in GML.
The server is (as I mentioned in my last post) Gamemaker server and to be specific v2.2.5
however I tried the network_connect_raw ; and still getting the same output

client side
Code:
WebSocket connection to 'wss://18.xx.xx.xx:9000/' failed: Error in connection establishment: net::ERR_CONNECTION_CLOSED
from the server side
GML:
Client(1) Connected: 91.xx.xx.xx
Socket(1): WS handshake failed (first packet isn't a HTTP request).
Request data: 16 03 01 02 00 01 00 01 fc 03 03 Q 08 95 k x 3 : ee y a7 Z 8b 99 92 e4 80 96 c7 dd f b5 ee 01 0c c6 a6 - D 15 e2 D d6   & 11 90 0e 12 z f0 = w 1c m u 00 8d ) d0 99 95 $ 96 f3 l 2 f0 ' f5 09 d4 d2 ac 8c Q 00 " 8a 8a 13 01 13 02 13 03 c0 + c0 / c0 , c0 0 cc a9 cc a8 c0 13 c0 14 00 9c 00 9d 00 / 00 5 00 0a 01 00 01 91 9a 9a 00 00 00 17 00 00 ff 01 00 01 00 00 0a 00 0a 00 08 aa aa 00 1d 00 17 00 18 00 0b 00 02 01 00 00 # 00 00 00 05 00 05 01 00 00 00 00 00 0d 00 14 00 12 04 03 08 04 04 01 05 03 08 05 05 01 08 06 06 01 02 01 00 12 00 00 00 3 00 + 00 ) aa aa 00 01 00 00 1d 00   b d0 9d L 0d e3 de e D 09 d5 ~ 9d O bc = 02 m 86 P ? 03 M cc bb 87 ] f9 14 a6 f6 C 00 - 00 02 01 01 00 + 00 0b 0a 0a 0a 03 04 03 03 03 02 03 01 00 1b 00 03 02 00 02 J J 00 01 00 00 15 00 f3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Resizing swap chain...Pause event has been registered for this frame
I have to mention that the server I use is windows server 2016 and I have not installed a certificate on it yet! till now I have no idea if I should do something like that? I cannot imagine a secure connection without having a certificate key used on both sides ... in this case, my website is secured with ssl but my back end is just an EC2 machine in aws...
 

FrostyCat

Member
In that case, it's probably because the server is still talking in plaintext Websockets while the HTML5 client is talking in encrypted Websockets (for wss). Since GML's networking functions don't support certificates, I don't think this can be reconciled as-is. Either serve your HTML5 page over plain HTTP, or rewrite your server in a language that supports WSS.
 

jaber

Member
In that case, it's probably because the server is still talking in plaintext Websockets while the HTML5 client is talking in encrypted Websockets (for wss). Since GML's networking functions don't support certificates, I don't think this can be reconciled as-is. Either serve your HTML5 page over plain HTTP, or rewrite your server in a language that supports WSS.
I see... and this is exactely I was afraid from.... because I can not serve HTML5 over HTTP as facebook integration requires https... in the other hand, I dont know any alternative to my GML server! do u have any suggestions where do I start to build a WSS compatible server? so I dont have reinvent the wheel :( I will look meanwhile in marketplace
 

FrostyCat

Member
Aside from requesting on help.yoyogames.com that YoYo add support for SSL in networking functions, there's not much I can think of that can help you.
 

jaber

Member
Aside from requesting on help.yoyogames.com that YoYo add support for SSL in networking functions, there's not much I can think of that can help you.
thanks..I have just submitted a request..
for any one who may pass through this thread, I would appreciate your advice in regard to Server side alternatives to GML that support secured web sockets -wss-
thnx
 
Top