async fn create_server(&self, states: Arc<Mutex<StatesList>>, core_sender: Sender<Messages>) {
        // Create a WebSockets Manager which acts as Middleware
        let ws_middleware =
            WebSocketsManager::new(self.sockets.clone(), core_sender, states.clone());

        // Create the HTTP JSON RPC server
        let mut http_io = IoHandler::default();
        let manager = RpcManager { states };
        http_io.extend_with(manager.to_delegate());

        let http_cors = self.json_rpc_http_cors.clone();
        let http_port = self.port;

        // Run the HTTP JSON RPC in a separate thread
        thread::spawn(move || {
            let server = jsonrpc_http_server::ServerBuilder::new(http_io)
                .request_middleware(ws_middleware)
                .cors(http_cors)
                .rest_api(RestApi::Unsecure)
                .start_http(&format!("127.0.0.1:{}", http_port).parse().unwrap())
                .expect("Unable to start RPC HTTP server");
            server.wait();
        });
    }
// Create the HTTP JSON RPC Server
Create the HTTP JSON RPC Server
Create the HTTP JSON RPC Server
async fn create_server(&self, states: Arc<Mutex<StatesList>>, core_sender: Sender<Messages>) {
        // Create a WebSockets Manager which acts as Middleware
        let ws_middleware =
            WebSocketsManager::new(self.sockets.clone(), core_sender, states.clone());
        // Create the HTTP JSON RPC server
        let mut http_io = IoHandler::default();
        let manager = RpcManager { states };
        http_io.extend_with(manager.to_delegate());
        let http_cors = self.json_rpc_http_cors.clone();
        let http_port = self.port;
        // Run the HTTP JSON RPC in a separate thread
        thread::spawn(move || {
            let server = jsonrpc_http_server::ServerBuilder::new(http_io)
                .request_middleware(ws_middleware)
                .cors(http_cors)
                .rest_api(RestApi::Unsecure)
                .start_http(&format!("127.0.0.1:{}", http_port).parse().unwrap())
                .expect("Unable to start RPC HTTP server");
            server.wait();
        });
    }
async fn create_server ( & self , states : Arc < Mutex < StatesList > > , core_sender : Sender < Messages > ) { // Create a WebSockets Manager which acts as Middleware let ws_middleware = WebSocketsManager :: new ( self . sockets . clone ( ) , core_sender , states . clone ( ) ) ; // Create the HTTP JSON RPC server let mut http_io = IoHandler :: default ( ) ; let manager = RpcManager { states } ; http_io . extend_with ( manager . to_delegate ( ) ) ; let http_cors = self . json_rpc_http_cors . clone ( ) ; let http_port = self . port ; // Run the HTTP JSON RPC in a separate thread thread :: spawn ( move | | { let server = jsonrpc_http_server :: ServerBuilder :: new ( http_io ) . request_middleware ( ws_middleware ) . cors ( http_cors ) . rest_api ( RestApi :: Unsecure ) . start_http ( & format ! ( " " http_port ) . parse ( ) . unwrap ( ) ) . expect ( " " ) ; server . wait ( ) ; } ) ; }
Create the HTTP JSON RPC Server
Create the HTTP JSON RPC Server
&self
states
Arc<Mutex<StatesList>>
core_sender
Sender<Messages>