implements sockets on connection before db query