lpereira / lwan

Experimental, scalable, high performance HTTP server
https://lwan.ws
GNU General Public License v2.0
5.92k stars 549 forks source link

Websocket support feature #230

Closed Globik closed 4 years ago

Globik commented 6 years ago

It would be nice to have websocket.

lpereira commented 6 years ago

Closing as duplicate of #17.

lpereira commented 6 years ago

Reopening this issue: issue #17 has been modified to track only implementation of HTTP/2. Experimental websockets has been pushed to the websockets-experimental branch.

ghost commented 5 years ago

Is lwan_response_websocket_read supposed to work by now?

I can run the websocket sample but when I modify it to wait for data, lwan_response_websocket_read call just eats control flow and disconnects the client.

Something like this:

LWAN_HANDLER(ws)
{
    enum lwan_http_status status = lwan_request_websocket_upgrade(request);

    if (status != HTTP_SWITCHING_PROTOCOLS)
        return status;

    while (true) {
        lwan_response_websocket_read(request)
        lwan_response_websocket_write(request);
    }

    return HTTP_OK;
}
lpereira commented 5 years ago

Will look at it whenever I'm close to my computer. It should be working, but this code has been refactored so much without tests that there might be indeed issues.

On Mon, Nov 12, 2018, 07:20 Alex Hultman notifications@github.com wrote:

Is lwan_response_websocket_read supposed to work by now?

I can run the websocket sample but when I modify it to wait for data, lwan_response_websocket_read call just eats control flow and disconnects the client.

Something like this:

LWAN_HANDLER(ws) { enum lwan_http_status status = lwan_request_websocket_upgrade(request);

if (status != HTTP_SWITCHING_PROTOCOLS)
    return status;

while (true) {
    lwan_response_websocket_read(request)
    lwan_response_websocket_write(request);
}

return HTTP_OK;

}

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/lpereira/lwan/issues/230#issuecomment-437919372, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA6mbPWF6iY94eveilZ589-9IUHYcEIks5uuZG8gaJpZM4TzGSA .

lpereira commented 4 years ago

It should be working now, ~2 years later. The sample app has 3 samples in one now, including a chat app with an internal pub/sub mechanism.