Subscribing to a TopicΒΆ

You need a long running wampy application process for this.

from wampy.peers.clients import Client
from wampy.roles.subscriber import subscribe


class WampyApp(Client):

    @subscribe(topic="topic-name")
    def weather_events(self, topic_data):
        # do something with the ``topic_data`` here
        pass

See runnning a wampy application for executing the process.