zero4rs 2.0.0

zero4rs is a powerful, pragmatic, and extremely fast web framework for Rust
Documentation
use crate::commons::parse_json_string;

use crate::websocket::webchat::actions::Broadcast;
use crate::websocket::webchat::connection::Connection;
use crate::websocket::webchat::server::Server;

pub fn process1(svr: &actix::Addr<Server>, channel: &str, message: &str) {
    if let Ok(message) = parse_json_string::<Broadcast>(message) {
        log::info!(
            "Processing a message: channel={}, level={:?}, ty={:?}, msg={}",
            channel,
            message.level,
            message.ty,
            message.msg
        );

        svr.do_send(message);
    } else {
        log::error!(
            "subscribe_channel: channel={}, message={}",
            channel,
            message
        );
    }
}

pub fn process2(_svr: &actix::Addr<Server>, channel: &str, connection_id: &str) {
    log::info!(
        "Close a connection: channel={}, connection_id={}",
        channel,
        connection_id
    );

    Connection::pending_remove(connection_id);
}