If ```socket === undefined```, the else block never fulfills the promise returned by the method.