Better HN
topnewbestaskshowjobs
Log inSign up

asergeyev

11 karma · joined Feb 14, 2015 (11y ago) · 11 submissions

Alex Sergeyev; https://twitter.com/alexsergeyev
Submissions

comment 11y ago · link · parent

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.

comment 11y ago · link · parent

rapind did nice experiment in comments above.

comment 11y ago · link · parent

Thanks for that experiment!

comment 11y ago · link · parent

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.

comment 11y ago · link · parent

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.

comment 11y ago · link · parent

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.

comment 11y ago · link · parent

Untold rule is not to run "sudo websocketd --devconsole bash" :)

comment 11y ago · link · parent

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

comment 11y ago · link · parent

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.

comment 11y ago · link · parent

Pretty much. Good example is Joe's vmstats https://github.com/joewalnes/web-vmstats

comment 11y ago · link · parent

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.