async_callback

Macro async_callback 

Source
macro_rules! async_callback {
    ($f:expr) => { ... };
}
Expand description

A macro to wrap an async callback function to be used in the client.

This macro is used to wrap a callback function that can handle a specific event.

use rust_socketio::async_callback;
use rust_socketio::asynchronous::{Client, ClientBuilder};
use rust_socketio::{Event, Payload};

pub async fn callback(payload: Payload, client: Client) {}

#[tokio::main]
async fn main() {
    let socket = ClientBuilder::new("http://example.com")
            .on("message", async_callback!(callback))
            .connect()
            .await;
}