Hi,

I have a network equipment which is similar with Cisco L3 switch. I use the 
mojo to setup a web server on Linux PC. In this case, I can use my  browser 
to run CLI command on my equipment.  (The JavaScript in the frond end send 
the CLI commands to the mojo server via websocket. The mojo web server run 
these commands on my equipment via ssh/telnet session at the back-end. 
Then, the web server send the CLI results to the  browser via websocket. )  
The web server works well with websokcket if run a few CLI commands. If 
there are many CLI commands were sent via the front end javascript, it will 
take a long time to run these commands on my equipment. The websocket will 
wait for all results done.  Then, send back all results to the browser 
side. Is there any way to send back result via websocket one by one without 
waiting all done?



websocket "/runcmd" => sub {

    my $c = shift;

    $c->on(message => sub {
        my ($c, @commands) = @_;
        
        foreach ( @commands)  {
       
            # call back end telnet/ssh session to run commands
            my $ret = backend( $_);

           $c->send( encode_json{ restult => $ret});
       }

    });
    

}

Thanks,
Peter L

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to