Open abrownsword opened 2 years ago
I might use this too
The idea is more to use a common event loop across all libraries you use, than to manually deal with FD. For instance if you do Asio there is a compilation flag for using Asio under uSockets
Yes, but sometimes you are just going to have a file descriptor you want that common event loop to use. The OS and most other code deals in file descriptors, so there ought to be a way to introduce an externally created descriptor to enable interop with uWS. In my case I needed to send an accepted socket from another process, but there may be other such use cases.
This is going to get merged from Bun (where you also have attach/release) in a while.
Add new function us_socket_transfer by extracting existing code for handling accepted sockets, and calling it from its former location. The new function can now be used to hand off a newly connected socket from outside the framework into the framework.