Lurker News

Comments (140) 32 threads

Earlier comments
hurin2 replies#
Could anyone give an example of what this is used for?
runewell1 reply#
It appears to me that it is useful for eliminating the "middle man" scripts/code often written for web application and server interaction. If I want to create a web application that displays the status of my server (CPU, memory, I/O, etc) I can use this software to call vmstat directly instead of writing an API (PHP, Node.js, RoR, etc) that executes the same command or uses a library that requires even more code to get the exact same data.
hurin#
I'm sure this this is probably because I don't have do this for work - but from that description it's hard for me to tell what the advantages are. A script to feed vmstat (or other command data) with a python socket would be ~50 lines or so.
joewalnes#
It allows you to write a WebSocket end point, in any programming language, without having to deal with building socket servers, dealing with WebSocket protocol handshake/parsing/formatting/etc, worrying about threading etc. Just write a script that reads and writes to stdin/out.
dkarapetyan#
This is cool. I can see this being used for prototyping and validating an idea before going full steam ahead with a more scalable framework.
MatthewWilkes1 reply#
It's a petty comment, I know, but:

    for count in range(0, 10):
      print count + 1
      sleep(0.5)
makes me feel sad.
asergeyev#
Please ignore complexity of supplied examples... It's really not for that kind of use. I have lots of scripts that do something like this (and most of them are not in bash :)...):

    while read ARG; do
          if validate $ARG; then
                run_something $ARG
          fi
    done
Most of my "validate" pieces are bash functions and most "run_something" return lengthy CSV datablocks.

Then, there is the javascript that uses user mouse (and other signals) to generate arguments to send to websocketd and draw pretty visuals based on data that arrives back.

spiralpolitik1 reply#
I assume you are treating `stdin` and `stdout` as just a stream of bytes rather than trying to do anything clever a la Python 3 ?
joewalnes#
Yep. The only magic thing is a line break (e.g. \n) is used to terminate each message.

Load more comments