Skip to content

Commit

Permalink
Add some logs
Browse files Browse the repository at this point in the history
  • Loading branch information
gzurowski committed May 31, 2024
1 parent 5b1cb76 commit ff5c271
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/user/consumers.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def get_dynamic_paper_serializer(data, **kwargs):

class PaperSubmissionConsumer(AsyncWebsocketConsumer):
async def connect(self):
print("connect...")
if "user" not in self.scope:
self.close(code=401)
raise StopConsumer()
Expand All @@ -76,6 +77,7 @@ async def connect(self):
await self.accept(subprotocol="Token")

async def receive(self, text_data=None, bytes_data=None):
print("receive...")
# TODO: Sanitize data?
data = json.loads(text_data)
submission_id = data["paper_submission_id"]
Expand All @@ -84,6 +86,7 @@ async def receive(self, text_data=None, bytes_data=None):
await self.notify_paper_submission_status({"id": submission_id})

async def disconnect(self, close_code):
print("disconnect...")
if close_code == 401 or not hasattr(self, "room_group_name"):
return
else:
Expand All @@ -100,6 +103,7 @@ async def _get_duplicate_paper_data(self, ids):
return data

async def notify_paper_submission_status(self, event):
print("notify_paper_submission_status...")
# Send message to webSocket (Frontend)
extra_metadata = {}
submission_id = event["id"]
Expand Down

0 comments on commit ff5c271

Please sign in to comment.