refactored sockjs factory to use promises for callbacks rather than events