The :fiber_concurrency
plugin enables connections a session to be used seamlessly across fibers managed by a fiber scheduler. This is of particular relevance if the connections are long-lived/persistent.
Note that, if you’re using the :persistent
plugin, this plugin is required by default.
http = HTTPX.plugin(:fiber_concurrency)
Thread.start do
# assuming fiber scheduler is set here
10.times.each do
Fiber.schedule do
http.get("https://example.com")
end
end
end
This plugin is a requirement if you’re using httpx
in programs with a fiber scheduler. This includes, for example, programs developed using the async gem.
Next: Custom Plugins