Beispiel #1
0
 def _initialize(self, session: ISession, details):  # pylint: disable=unused-argument
     self._session = session
     session.register(self.create_game, "com.werewolf.create_game")
     session.register(self.join_game, "com.werewolf.join_game")
     session.register(self.start_game, "com.werewolf.start_game")
     session.register(self.select_player, "com.werewolf.select_player")
     session.register(self.player_listen_topic,
                      "com.werewolf.player_listen_topic")
Beispiel #2
0
         if msg.kwargs:
            if msg.args:
               exc = exception.ApplicationError(msg.error, *msg.args, **msg.kwargs)
            else:
               exc = exception.ApplicationError(msg.error, **msg.kwargs)
         else:
            if msg.args:
               exc = exception.ApplicationError(msg.error, *msg.args)
            else:
               exc = exception.ApplicationError(msg.error)

      return exc



ISession.register(BaseSession)



class ApplicationSession(BaseSession):
   """
   WAMP endpoint session. This class implements

   * :class:`autobahn.wamp.interfaces.IPublisher`
   * :class:`autobahn.wamp.interfaces.ISubscriber`
   * :class:`autobahn.wamp.interfaces.ICaller`
   * :class:`autobahn.wamp.interfaces.ICallee`
   * :class:`autobahn.wamp.interfaces.ITransportHandler`
   """

   def __init__(self, config = None):
Beispiel #3
0
         if msg.kwargs:
            if msg.args:
               exc = exception.ApplicationError(msg.error, *msg.args, **msg.kwargs)
            else:
               exc = exception.ApplicationError(msg.error, **msg.kwargs)
         else:
            if msg.args:
               exc = exception.ApplicationError(msg.error, *msg.args)
            else:
               exc = exception.ApplicationError(msg.error)

      return exc



ISession.register(BaseSession)



class ApplicationSession(BaseSession):
   """
   WAMP endpoint session. This class implements

   * :class:`autobahn.wamp.interfaces.IPublisher`
   * :class:`autobahn.wamp.interfaces.ISubscriber`
   * :class:`autobahn.wamp.interfaces.ICaller`
   * :class:`autobahn.wamp.interfaces.ICallee`
   * :class:`autobahn.wamp.interfaces.ITransportHandler`
   """

   def __init__(self, config = None):
Beispiel #4
0
    """
    WAMP application session for Twisted-based applications.

    Implements:

        * :class:`autobahn.wamp.interfaces.ITransportHandler`
        * :class:`autobahn.wamp.interfaces.ISession`
    """

    log = txaio.make_logger()


ITransportHandler.register(ApplicationSession)

# ISession.register collides with the abc.ABCMeta.register method
ISession.abc_register(ApplicationSession)


class ApplicationSessionFactory(protocol.ApplicationSessionFactory):
    """
    WAMP application session factory for Twisted-based applications.
    """

    session: ApplicationSession = ApplicationSession
    """
    The application session class this application session factory will use. Defaults to :class:`autobahn.twisted.wamp.ApplicationSession`.
    """

    log = txaio.make_logger()