Backported socket support. Currently untested, since I need to fix Ace Editor first. But it doesn't break anything!