shouldn't this be ```ensurePort()(function onMessage(msg))```?