From d3843554fbabdfbac588cf7b5d1b96a5aff62c12 Mon Sep 17 00:00:00 2001 From: Jophy Ye <44258870+jophy-ye@users.noreply.github.com> Date: Wed, 16 Oct 2024 04:25:33 -0400 Subject: [PATCH] Added function prototype for BaseChannelLayer (#2112) --- channels/layers.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/channels/layers.py b/channels/layers.py index 48f7baca..99e7fbd6 100644 --- a/channels/layers.py +++ b/channels/layers.py @@ -186,6 +186,29 @@ def non_local_name(self, name): else: return name + async def send(self, channel, message): + raise NotImplementedError("send() should be implemented in a channel layer") + + async def receive(self, channel): + raise NotImplementedError("receive() should be implemented in a channel layer") + + async def new_channel(self): + raise NotImplementedError( + "new_channel() should be implemented in a channel layer" + ) + + async def flush(self): + raise NotImplementedError("flush() not implemented (flush extension)") + + async def group_add(self, group, channel): + raise NotImplementedError("group_add() not implemented (groups extension)") + + async def group_discard(self, group, channel): + raise NotImplementedError("group_discard() not implemented (groups extension)") + + async def group_send(self, group, message): + raise NotImplementedError("group_send() not implemented (groups extension)") + class InMemoryChannelLayer(BaseChannelLayer): """