I need send the qr variable to my frontend. I get a message trough socketio but when I try save the message and show in the console. I get this error. Help me.
#[tauri::command]
fn getQR() -> String {
let mut qr = String::new();
let callback = move |payload: Payload, socket: RawClient| {
match payload {
Payload::String(str) => {
qr.push_str(&str);
println!("Received: {}", qr);
},
Payload::Binary(bin_data) => println!("Received bytes: {:#?}", bin_data),
}
};
let mut socket = ClientBuilder::new("http://localhost:1425")
.namespace("/")
.on("message", callback)
.on("error", |err, _| eprintln!("Error: {:#?}", err))
.connect()
.expect("Connection failed");
println!("qr: {}", qr);
qr.into()
}