this post was submitted on 28 Sep 2025
5 points (100.0% liked)

Godot

7245 readers
3 users here now

Welcome to the programming.dev Godot community!

This is a place where you can discuss about anything relating to the Godot game engine. Feel free to ask questions, post tutorials, show off your godot game, etc.

Make sure to follow the Godot CoC while chatting

We have a matrix room that can be used for chatting with other members of the community here

Links

Other Communities

Rules

We have a four strike system in this community where you get warned the first time you break a rule, then given a week ban, then given a year ban, then a permanent ban. Certain actions may bypass this and go straight to permanent ban if severe enough and done with malicious intent

Wormhole

!roguelikedev@programming.dev

Credits

founded 2 years ago
MODERATORS
 

Hi, folks! ✌️ How are you? 👋

I'm working on the game that uses WebSocketPeer for multiplaying.

And when I runs the game, WebSocketPeer works as well. Also when I exports the game for Desktop platforms, then launches this, WebSocketPeer works also.

The problems happens when I exports the game for WebGL:

  1. I export the game for WebGL, compress this to a zip archive, then send this archive to the VPS server.

  2. Connect to this VPS server and unzip archive.

From a browser the game works very well, except connection through WebSocketPeer.

For running this game on a browser, I'm using NGINX as a HTTP server.

This game connect to the game server (that developed separately), that also located on the same machine, and also uses WebSocketPeer.

I have try to point the IP address of the VPS server in the configs of the game, and it doesn't works. Also doesn't works to point "127.0.0.1" in the configs of this game.

Folks, where's the problem may be? And what do I do wrong now? 😟

Thanks in advance.

top 2 comments
sorted by: hot top controversial new old
[–] xolatgames@programming.dev 1 points 3 months ago

This is a piece of logs from the browser console:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://127.0.0.1:777/abilities/active/all. (Reason: CORS request did not succeed). Status code: (null).
TypeError: NetworkError when attempting to fetch resource. game.js:474:18
Firefox can’t establish a connection to the server at ws://127.0.0.1:888/. game.js:9:219740
SCRIPT ERROR: Assertion failed. game.js:474:18
   at: HttpHighClient.send_request (res://scripts/common/http/http_high_client.gd:37) game.js:474:18
ERROR: Parse JSON failed. Error at line 0: Unknown error getting token game.js:474:18
   at: parse_string (core/io/json.cpp:582) game.js:474:18
�[91m�[1mERROR: �[22mDB API can't read this response: /abilities/active/all�[39m�[0m game.js:459:16

Firewall I've already checked.

[–] xolatgames@programming.dev 1 points 3 months ago

I changed the IP address from "127.0.0.1" for connection to the server in the configs of the game to the IP adress of the VPS. And in this case the logs from the browser console looks so now:

Blocked loading mixed active content “http://218.14.40.150:777/abilities/active/all%E2%80%9D game.js:9:186044
TypeError: NetworkError when attempting to fetch resource.
    create https://example.com/game.js:9
    _godot_js_fetch_create https://example.com/game.js:9
    callUserCallback https://example.com/game.js:9
    runIter https://example.com/game.js:9
    Browser_mainLoop_runner https://example.com/game.js:9
game.js:474:18
SCRIPT ERROR: Assertion failed. game.js:474:18
   at: HttpHighClient.send_request (res://scripts/common/http/http_high_client.gd:37) game.js:474:18
ERROR: Parse JSON failed. Error at line 0: Unknown error getting token game.js:474:18
   at: parse_string (core/io/json.cpp:582) game.js:474:18
�[91m�[1mERROR: �[22mDB API can't read this response: /abilities/active/all�[39m�[0m game.js:459:16
ERROR: DB API can't read this response: /abilities/active/all game.js:474:18
   at: push_error (core/variant/variant_utility.cpp:1098) game.js:474:18

But the connection still won't works 🤷‍♂️

P.S: Some content from the logs was changed for privacy reason.