daphne added to dependencies; still reliant on uvicorn, as the former is now used solely as a channels testing req'ment; new consumer model in apps.epic.consumers to handle _gatekeeper partial functionality, permitting access to room once token costs met; new .routing urlpattern to accomodate; new tests.integrated.test_consumer IT cases ensure this functionality
This commit is contained in:
@@ -1 +1,18 @@
|
||||
# RoomConsumer goes here
|
||||
from channels.generic.websocket import AsyncJsonWebsocketConsumer
|
||||
|
||||
|
||||
class RoomConsumer(AsyncJsonWebsocketConsumer):
|
||||
async def connect(self):
|
||||
self.room_slug = self.scope["url_route"]["kwargs"]["room_slug"]
|
||||
self.group_name = f"room_{self.room_slug}"
|
||||
await self.channel_layer.group_add(self.group_name, self.channel_name)
|
||||
await self.accept()
|
||||
|
||||
async def disconnect(self, close_code):
|
||||
await self.channel_layer.group_discard(self.group_name, self.channel_name)
|
||||
|
||||
async def receive_json(self, content):
|
||||
pass # handlers added as events introduced
|
||||
|
||||
async def gate_update(self, event):
|
||||
await self.send_json(event)
|
||||
|
||||
Reference in New Issue
Block a user