Beispiel #1
0
 def leave(self, reason=None, message=None):
     """
   Implements :func:`autobahn.wamp.interfaces.ISession.leave`
   """
     if not self._goodbye_sent:
         msg = wamp.message.Goodbye(reason=reason, message=message)
         self._transport.send(msg)
         self._goodbye_sent = True
     else:
         raise SessionNotReady(u"Already requested to close the session")
Beispiel #2
0
   def leave(self, reason = None, log_message = None):
      """
      Implements :func:`autobahn.wamp.interfaces.ISession.leave`
      """
      if not self._session_id:
         raise Exception("not joined")

      if not self._goodbye_sent:
         if not reason:
            reason = u"wamp.close.normal"
         msg = wamp.message.Goodbye(reason = reason, message = log_message)
         self._transport.send(msg)
         self._goodbye_sent = True
      else:
         raise SessionNotReady(u"Already requested to close the session")
Beispiel #3
0
    def leave(self, reason=None, log_message=None):
        """
        Implements :func:`autobahn.wamp.interfaces.ISession.leave`
        """
        if not self._session_id:
            raise Exception("not joined")

        if not self._goodbye_sent:
            if not reason:
                reason = u"wamp.close.normal"
            msg = wamp.message.Goodbye(reason=reason, message=log_message)
            self._transport.send(msg)
            self._goodbye_sent = True
            # deferred that fires when transport actually hits CLOSED
            is_closed = self._transport is None or self._transport.is_closed
            return is_closed
        else:
            raise SessionNotReady(u"Already requested to close the session")