updated socket api callback to return socket ref