HNHacker News
TopNewBestAskShowJobs

asergeyev

11 karma · joined February 14, 2015

Alex Sergeyev; https://twitter.com/alexsergeyev
submissionscomments
asergeyev··on Show HN: A Unixy approach to WebSockets
There is nothing wrong with server side events. I even played with them already.

But for bi-directional communication we do have to use websockets and it's the good tool for the job.

If you'd like to see maybe event source is something that could be added to websocketd as additional protocol, start conversation in issues, nothing is wrong with pitching an idea. We already got cgi and static html because it's not always about websockets, sometimes you want other things handy.

asergeyev··on Show HN: A Unixy approach to WebSockets
rapind did nice experiment in comments above.
asergeyev··on Show HN: A Unixy approach to WebSockets
Thanks for that experiment!
asergeyev··on Show HN: A Unixy approach to WebSockets
Difference with cgi is that they are live and die, with each user request. websocketd programs are more like "one per user session"... Makes sense when your user sessions are lengthy.
asergeyev··on Show HN: A Unixy approach to WebSockets
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.

asergeyev··on Show HN: A Unixy approach to WebSockets
Since there is so much pointless discussion about use of text streams under this comment.

When someone has example of situation when binary, json or other communication between websocketd and program is needed, please just file a ticket, it would be great to see practical situation instead of just arguing with each other about text stream/unix principles/json and other stuff.

asergeyev··on Show HN: A Unixy approach to WebSockets
Untold rule is not to run "sudo websocketd --devconsole bash" :)
asergeyev··on Show HN: A Unixy approach to WebSockets
Not supported in any of IE versions... https://status.modern.ie/serversenteventseventsource?term=Ev...

And WebSockets is working since IE10 https://status.modern.ie/websocket?term=WebSocket

asergeyev··on Show HN: A Unixy approach to WebSockets
There is closed ticket (github.com/joewalnes/websocket) where we were battling this out, you're always welcome to join with good ideas, that would be appreciated.
asergeyev··on Show HN: A Unixy approach to WebSockets
Pretty much. Good example is Joe's vmstats https://github.com/joewalnes/web-vmstats
asergeyev··on Show HN: A Unixy approach to WebSockets
Also websocketd is multiplatform and does not require python. Neither good or bad, just another difference :)

Also, not sure if websocketify can but websocketd also has --dir argument and can supervise and route many sockets to many different programs.