Why longpoll if sockets are available? I've noticed that the bitcoin client uses sockets.

I've also seen that long polling is not only available but is also recommended.

Why?  Isn't long polling far less efficient than sockets?
Don't confuse the way bitcoin clients talk to each other (peer to peer, speaking the Bitcoin protocol) with the way the bitcoin client talks to RPC clients (server to client, with bitcoind acting as an HTTP server speaking JSON-RPC).

When the bitcoin client speaks RPC, it uses HTTP. Long polling is much more efficient than HTTP without long polling, which is why long polling was created and why it's recommended if you're using RPC.

However, using RPC for miners to talk to the systems that issue them work is rapidly becoming obsolete. Stratum replaces that, and it uses a native method that's more efficient than long polling.