[Libwebsockets] Example of custom event loop integration?

Felipe Gasper felipe at felipegasper.com
Sun May 30 02:21:07 CEST 2021


	I’m considering writing a Perl binding to libwebsockets. For this to work I need to be able to integrate libwebsockets into whatever event loop the Perl application runs. (There are many loops, and three widely-used abstraction interfaces over them.)

	I found the HTTP-server foreign event lib integration example: https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/http-server/minimal-http-server-eventlib-foreign/minimal-http-server-eventlib-foreign.c

	This example, though, appears only to use event libraries that libwebsockets natively supports. Does libwebsockets include an interface like libcurl’s multi_socket interface (cf. https://curl.se/libcurl/c/libcurl-multi.html)? That seems to be what `struct lws_event_loop_ops` and `struct lws_plugin_evlib` represent … are there any examples of giving these structs to libwebsockets at runtime?

	Thank you!

-Felipe Gasper

More information about the Libwebsockets mailing list