Add `connect` and `listen` functions