Skip to content

Commit

Permalink
Added function prototype for BaseChannelLayer (#2112)
Browse files Browse the repository at this point in the history
  • Loading branch information
jophy-ye authored Oct 16, 2024
1 parent 52b4470 commit d384355
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions channels/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down

0 comments on commit d384355

Please sign in to comment.