I'm thinking about building the same type of system. To be very honest, I
thought about websockets but wouldn't know where to start.
In a homemade config backup system, I decided to migrate the configuration
file to a nice CRUD frontend built with Mojolicious + AngularJS +
Bootstrap. As a nice-to-have feature, I thought that each time a user adds
a new element to the configuration (e.g.: a new host to backup) , it could
deploy a backend job to test a simple command such as "show version" on the
node and that the result could be sent to a websocket so that a status
light indicator could be displayed on the node's line. (in a table).
Anyways, I'm very interested in that project, please share your success !
Cheers,
Luc
On Friday, 18 January 2019 00:30:07 UTC-5, Peter L wrote:
>
> Hi,
>
> I have a network equipment which is similar to the Cisco L3 switch. I use
> mojo to setup a web server on a Linux PC. The browser can send some CLI
> commands via websocket to web server. The web server can run these commands
> on network equipment and send all the results back to the browser via
> websocket. It works. But, It need to take some time to wait for all results
> done. In this case, if I have many CLI commands, it will take a long time
> to wait all results done. I want to send the result back to the browser if
> one command is executed without waiting for the other commands executing.
> Is there any way to do it via websocket?
>
>
>
> websocket "/runcmd" => sub {
>
> $c->shift;
>
> ...
>
> $c->on(message => sub {
> my ($c, @commands) = @_;
>
> foreach ( @commands) {
>
> # back-end to run commands via ssh/telnet session
> my $ret = backend( $_);
>
> $c->send( encode_json { result => $ret});
> }
>
> });
>
> ...
> }
>
> Thanks,
> Peter
>
--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/mojolicious/ee3ce022-bd32-48e7-8419-44803c5a08cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.