joewalnes / websocketd

Turn any program that uses STDIN/STDOUT into a WebSocket server. Like inetd, but for WebSockets.

Home Page:http://websocketd.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

stdin only works once?

coderofsalvation opened this issue · comments

Im doing something wrong here...it seems to not receive anything after the first RCVD-msg:

image
this is the responsible code:
image

As you can see, I tried to remove linebreaks, as console.log already produces a linebreak (would result in two linebreaks).
However, that's not fixing it :/
Running the script on the commandline works fine:

$ qjs app.js
image

solved!
turns out I had to call std.out.flush().
The C99 example revealed this :)

I made a PR so quickjs users will have an easier headstart: #396