code: def on_recv(self, callback):
          '''
          Register a callback for received messages (that we didn't initiate)
          '''
          if callback is None:
              self._on_recv = callback
          else:
              def wrap_recv(header, body):
                  callback(body)
              self._on_recv = wrap_recf on_recv(self, callback):
          '''
          Register a callback for received messages (that we didn't initiate)
          '''
          if callback is None:
              self._on_recv = callback
          else:
              def wrap_recv(header, body):
                  callback(body)
              self._on_recv = wrap_recv
docs: Register a callback for received messages (that we didn't initiate)