5

My application wants to pass $env->{'psgix.io'} handle to separate process for further WebSocket processing. Pass via UNIX socket dup()s handle, so I don't really care to return any answer from application to PSGI server. But I see no option to just silently close connection without returning any response from application. When I return nothing, PSGI server is not happy and logs "500 Internal Server Error". When I return just code reference like sub {}, then Twiggy is happy but uWSGI is not. Any other valid PSGI answer breaks WebSocket protocol.

I tried to dup() raw handle and return last part of the WebSocket handshake as the PSGI answer, it worked with uWSGI but didn't with Twiggy.

I looked through different PSGI/WebSocket implemetation and they do one of:

  1. don't return from handler at all until WebSocket is closed;
  2. return some kind of sub {}.

What is the right way to return no answer and silently close connection in PSGI protocol?

UPDATE: It looks like Twiggy uses [] as PSGI cancel message. My patch for uwsgi to do the same was successfully merged.

0 Answers0