Comments (6)
Hey @Coxcopi could you share a snippet of your code and where the exception is raised?
from nakama-godot.
@lugehorsam sure, this is what the code for setting up client and socket looks like:
func setup() -> void:
_client = _connect_to_server()
_socket = _create_socket(_client)
func _connect_to_server() -> NakamaClient:
var client : NakamaClient = Nakama.create_client(
"defaultkey",
"127.0.0.1",
7350,
"http",
3,
NakamaLogger.LOG_LEVEL.INFO
)
client.timeout = CLIENT_REQUEST_TIMEOUT
return client
func _create_socket(client : NakamaClient) -> NakamaSocket:
if (!client):
return null
return Nakama.create_socket_from(client)
And here's when I tried using methods from the socket:
Joining Matchmaker:
func join_matchmaker(query : String = "*", min_count : int = 2, max_count : int = 8) -> void:
var socket : NakamaSocket = NetServerConnection.get_socket()
if (!socket):
return
var ticket_response : NakamaRTAPI.MatchmakerTicket = await socket.add_matchmaker_async(
query,
min_count,
max_count
)
if (ticket_response.is_exception()):
Logger.log_error("NetMatchManager: join_matchmaker() error: %s" % ticket_response)
matchmaker_ticket = ticket_response.ticket
Following friends status:
func follow_friends_status() -> void:
var socket : NakamaSocket = NetServerConnection.get_socket()
if (!socket):
return
var friends_result : Array[NakamaAPI.ApiUser] = await get_friends(FriendshipState.MUTUAL, 20)
var friend_ids : Array[String] = []
for user in friends_result:
if (!user.online):
continue
friend_ids.append(user.id)
var result : NakamaAsyncResult = await socket.follow_users_async(friend_ids, [])
if (result.is_exception()):
Logger.log_error("PresenceManager: follow_friends_status() error: %s" % result.get_exception().message)
Both of these resulted in the error I mentioned, and I can't seem to figure out where the problem is coming from.
from nakama-godot.
Not sure if that information is also relevant but I'm running the latest nakama docker image locally on a Windows 10 machine using Docker Desktop.
from nakama-godot.
The Request cancelled.
cancelled message comes from the client when there's an error sending data on the WebSocket.
Is there any information in the Nakama logs? In particular, do you see the WebSocket connection coming through?
Also, your code doesn't show authenticating before creating the socket. I'm assuming you're doing that and simply not showing it, but double checking just in case. :-)
from nakama-godot.
@dsnopek there actually is an error thrown in Godot (which I unfortunately didn't really notice before, otherwise I would've included it in the original issue of course), which seems to happen in the NakamaSocketAdapter.send()
method:
E 0:00:12:0795 NakamaSocketAdapter.gd:54 @ send(): Condition "ready_state != STATE_OPEN" is true. Returning: FAILED
Looks like something's wrong with the WebSocket, though I'm not sure if it's an issue with the Nakama addon code or if I'm just missing something.
Also you're absolutely right, I left out the authentication code as I don't think it has to do with the problem, and I made sure that the authentication was working as intended.
Full stacktrace:
<C++ Source> modules/websocket/wsl_peer.cpp:703 @ _send()
<Stack Trace> NakamaSocketAdapter.gd:54 @ send()
NakamaSocket.gd:295 @ _send_async()
NakamaSocket.gd:351 @ follow_users_async()
net_account_manager.gd:237 @ follow_friends_status()
net_account_manager.gd:1347839312 @ get_friends()
NakamaClient.gd:1347838512 @ list_friends_async()
NakamaAPI.gd:1347838192 @ list_friends_async()
NakamaHTTPAdapter.gd:1347836752 @ send_async()
NakamaHTTPAdapter.gd:1347841872 @ _send_async()
NakamaHTTPAdapter.gd:1347842832 @ make_request()
from nakama-godot.
It turns out I'm incredibly stupid. I spent hours digging through the addon code trying to find errors when I just now realized that I never actually called _socket.connect()
, which of course has my methods fail simply because the socket obviously can't send anything without a connection.
I apologize for keeping this issue open for so long (and making it in the first place), next time I'll check my own code first 😄
from nakama-godot.
Related Issues (20)
- "Array cannot be null" error when making RPC call in C# using GodotHttpAdapter HOT 1
- Nakama does not work for Godot 4.0 HOT 3
- Socket is not working with Godot 4 HOT 2
- Update tutorials for Godot 4 HOT 3
- Nakama plugin not visible in Godot 4.0.3 HOT 3
- Method return value cannot match type, Causing errors in Godot4.0. HOT 1
- NakamaMultiplayerBridge with Authoritative HOT 4
- Nakama Server Disconnection Issue with Fifth Player in Godot Engine Game HOT 1
- Add match_label API
- Game crashes on HTTP request HOT 3
- Pass Error Information to Godot 4 client
- Question - RPG/OpenWorld style multiplayer
- Party presence event is not received by client when party is created HOT 3
- p_create arguments authenticate_email_async doesn't work HOT 1
- Export on exe not working with server connections
- Getting Request 1 failed with result: 13, response code: 0 on client.authenticate_email_async(email, password) HOT 4
- Metadata is supported for relayed matches, but I can't create a new match with metadata, only joining is possible. HOT 1
- Incomplete Session Restore HOT 1
- When passing name with create_match_async then listing the match label is null HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nakama-godot.