Hi Tiago,
> Is there already the possibility of passing the tcp socket class to
> the constructor (or an open socket)? Something like:
>
> conn = PG.connect( dbname: 'sales', tcp_socket_class: Celluloid::IO::TCPSocket )
Unfortunately not. The underlying library "libpq" does not support such
a use case. It always handles the communication socket by itself.
However ruby-pg (and libpq as well) fully supports non blocking
operations on all functions, that perform network communication. That
typically works like this:
1. send a query to the server per (asynchronous) PG method
2. get the connection socket IO object per PG::Connection#socket_io
3. Give this IO object a the actor, so that it can wait for activity on
the socket
4. retrieve data per (asynchronous) PG method
This all is implemented for eventmachine already in:
https://github.com/royaltm/ruby-em-pg-client
--
Regards,
Lars