How to use the socketshark.events.SubscriptionEvent function in socketshark

To help you get started, we’ve selected a few socketshark examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github closeio / socketshark / socketshark / events.py View on Github external
class SubscribeEvent(SubscriptionEvent):
    async def process(self):
        await super().process()
        await self.subscription.subscribe(self)
        return True


class MessageEvent(SubscriptionEvent):
    async def process(self):
        await super().process()
        await self.subscription.message(self)
        return True


class UnsubscribeEvent(SubscriptionEvent):
    async def process(self):
        await super().process()
        await self.subscription.unsubscribe(self)
        return True
github closeio / socketshark / socketshark / events.py View on Github external
'subscription': self.subscription_name,
        } if self.subscription_name else {})

    async def process(self):
        self.subscription.validate()
        return True


class SubscribeEvent(SubscriptionEvent):
    async def process(self):
        await super().process()
        await self.subscription.subscribe(self)
        return True


class MessageEvent(SubscriptionEvent):
    async def process(self):
        await super().process()
        await self.subscription.message(self)
        return True


class UnsubscribeEvent(SubscriptionEvent):
    async def process(self):
        await super().process()
        await self.subscription.unsubscribe(self)
        return True
github closeio / socketshark / socketshark / events.py View on Github external
async def send_error(self, error, data=None):
        await super().send_error(error, data=data, extra_data={
            'subscription': self.subscription_name,
        } if self.subscription_name else {})

    async def send_ok(self, data=None):
        await super().send_ok(data=data, extra_data={
            'subscription': self.subscription_name,
        } if self.subscription_name else {})

    async def process(self):
        self.subscription.validate()
        return True


class SubscribeEvent(SubscriptionEvent):
    async def process(self):
        await super().process()
        await self.subscription.subscribe(self)
        return True


class MessageEvent(SubscriptionEvent):
    async def process(self):
        await super().process()
        await self.subscription.message(self)
        return True


class UnsubscribeEvent(SubscriptionEvent):
    async def process(self):
        await super().process()