Connect a SockJSProtocolMachine to its heartbeater.

def withHeartbeater(cls, heartbeater):
        """Connect a SockJSProtocolMachine to its heartbeater."""
        instance = cls(heartbeater)
        heartbeater.writeHeartbeat = instance.heartbeat
        return instance