davidmoreno / onion

C library to create simple HTTP servers and Web Applications.
http://www.coralbits.com/libonion/
Other
2.02k stars 250 forks source link

Question about websockets.c #250

Open alanswx opened 5 years ago

alanswx commented 5 years ago

It seems like the websockets code (when in single threaded mode) sits inside it's own loop and doesn't service any of the other HTTP requests. Is this correct, or did I miss something in how to call the code?

How hard would it be to change it so that it returns to the main poll loop between websocket messages?

davidmoreno commented 5 years ago

It is correct.

It should be possible, but the event loop has no support for write epoll, so would block writing. Which is much better than blocking reading and writing.

If you manage to get a patch working, I will be glad to merge it.

Regards, David.