getnamo / SocketIOClient-Unreal

Socket.IO client plugin for the Unreal Engine.
Other
875 stars 237 forks source link

Cannot connect to SocketIO server #425

Open t0msk opened 3 months ago

t0msk commented 3 months ago

Hello,

I use Unreal Engine 5.3.2 on Linux, this is my Blueprint graph for connection:

image

TL;DR I have Persistent level where is SocketIO actor placed, so I can access it from everywhere, as you can see I just take ref from Persistent level, access SocketIO component and call Connect with params.

Problem is that my server doesn't register any connection, but when I use some SocketIO testing tool like: https://amritb.github.io/socketio-client-tool

and I set settings like: image

It will connect from that SocketIO testing tool, but not from UE, even when params are the same.

My SocketIO server is written in Rust, it looks like:

fn on_connect(socket: SocketRef, Data(data): Data<Value>) {
    info!("Socket.IO connected: {:?} {:?}", socket.ns(), socket.id);
    println!("Socket.IO connected: {:?} {:?}", socket.ns(), socket.id);
    socket.emit("auth", data).ok();

    socket.on(
        "message",
        |socket: SocketRef, Data::<Value>(data), Bin(bin)| {
            info!("Received event: {:?} {:?}", data, bin);
            println!("Received event: {:?} {:?}", data, bin);
            socket.bin(bin).emit("message-back", data).ok();
        },
    );

    socket.on(
        "message-with-ack",
        |Data::<Value>(data), ack: AckSender, Bin(bin)| {
            info!("Received event: {:?} {:?}", data, bin);
            println!("Received event: {:?} {:?}", data, bin);
            ack.bin(bin).send(data).ok();
        },
    );
}

    io.ns("/socket.io", on_connect);

    let app = axum::Router::new()
        .route("/", get(|| async { "Hello, World!" }))
        .route("/login", post(login))
        .layer(
            ServiceBuilder::new()
                .layer(CorsLayer::permissive()) // Enable CORS policy
                .layer(layer),
        );

For Rust I use this SocketIO server implementation: https://github.com/Totodore/socketioxide

getnamo commented 3 months ago

Do you disable auto-connect on component to ensure it connects with params instead at your bp call time?