Skip to content
This repository was archived by the owner on Nov 23, 2024. It is now read-only.
This repository was archived by the owner on Nov 23, 2024. It is now read-only.

WebSocket connection address is hard coded to 127.0.0.1 #24

@mneilly

Description

@mneilly

Using nakama-rs master branch to connect to a Nakama server on a remote host fails to connect because it is trying to connect to localhost instead.

2022-03-22T23:38:51.215471Z INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce GTX 1050", vendor:
screteGpu, backend: Vulkan }
2022-03-22T23:38:52.263251Z INFO qws: Queuing connection to ws://127.0.0.1:7350/ws?lang=en&status=true&token=e
eyJ1aWQiOiI1Mjg5ZTUzYy0wYjBjLTQ5OWQtYTc3Ni1mNzdmODMxMzBlNDkiLCJ1c24iOiJyamFNWWlTb1ZuIiwiZXhwIjoxNjQ4NTk3MTMyfQ.
NXNXa1k
2022-03-22T23:38:52.279627Z ERROR nakama_rs::web_socket: on_received: WebSocketError(WS Error <Io(Os { code: 11
"Connection refused" })>)

It appears that the localhost address is hardcoded in web_socket.rs here:

nakama-rs/src/web_socket.rs

Lines 708 to 710 in 3874d9b

async fn connect(&self, session: &Session, appear_online: bool, connect_timeout: i32) {
let ws_url = "ws://127.0.0.1";
let port = 7350;

Modifying the code directly to use the address of my remote results in a connection.

2022-03-22T23:43:43.510475Z INFO qws: Queuing connection to ws://192.168.1.124:7350/ws?lang=en&status=true&tokCJ9.eyJ1aWQiOiI1Mjg5ZTUzYy0wYjBjLTQ5OWQtYTc3Ni1mNzdmODMxMzBlNDkiLCJ1c24iOiJyamFNWWlTb1ZuIiwiZXhwIjoxNjQ4NTk3NDIqR6ovlmgr_s
Sending "{"cid":"1","matchmaker_add":{"min_count":2,"max_count":2,"query":"*","string_properties

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions