jgkaplan / gemini-server

Node server for the gemini protocol, based on express
ISC License
65 stars 9 forks source link

Async problem with response. #1

Closed akademy closed 3 years ago

akademy commented 3 years ago

Hi,

Am I right in thinking that this async code should still work under gemini? It's based on your example but with just setTimeout (representing some asynchronous call).

app.on('/input', (req, res) => {
    if(req.query){
        setTimeout( function() {
            res.data('you typed ' + req.query);
        }, 500)
    }else{
        res.input('type something');
    }
});

I'm getting a "Page not found" call after inputting some text. I believe it is incorrectly closing the call when the handler exits.

I'm using the GemiNaut browser.

Thanks.

jgkaplan commented 3 years ago

You're right; that should work. I'll try to push a fix soon