|
|
@ -158,6 +158,12 @@ def game_status_object(game, current_phase=None, players_with_fear=None):
|
|
|
|
status_hash = h.hexdigest()
|
|
|
|
status_hash = h.hexdigest()
|
|
|
|
status_obj['hash'] = status_hash
|
|
|
|
status_obj['hash'] = status_hash
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async_to_sync(get_channel_layer().group_send)(
|
|
|
|
|
|
|
|
"%s_status" % game.access_code, {
|
|
|
|
|
|
|
|
"type": "fear_tracker.hashcode_seen",
|
|
|
|
|
|
|
|
"hashcode": status_hash,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
return status_obj
|
|
|
|
return status_obj
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -343,6 +349,11 @@ class StatusLongPollConsumer(AsyncHttpConsumer):
|
|
|
|
|
|
|
|
|
|
|
|
await self.channel_layer.group_add("%s_status" % self.access_code,
|
|
|
|
await self.channel_layer.group_add("%s_status" % self.access_code,
|
|
|
|
self.channel_name)
|
|
|
|
self.channel_name)
|
|
|
|
|
|
|
|
await self.channel_layer.group_send(
|
|
|
|
|
|
|
|
"%s_status" % self.access_code, {
|
|
|
|
|
|
|
|
"type": "fear_tracker.hashcode_seen",
|
|
|
|
|
|
|
|
"hashcode": self.hashcode,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
async def http_request(self, message):
|
|
|
|
async def http_request(self, message):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
@ -358,6 +369,13 @@ class StatusLongPollConsumer(AsyncHttpConsumer):
|
|
|
|
await self.channel_layer.group_discard("%s_status" % self.access_code,
|
|
|
|
await self.channel_layer.group_discard("%s_status" % self.access_code,
|
|
|
|
self.channel_name)
|
|
|
|
self.channel_name)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def fear_tracker_hashcode_seen(self, event):
|
|
|
|
|
|
|
|
if self.hashcode != event["hashcode"]:
|
|
|
|
|
|
|
|
await self.channel_layer.group_send(
|
|
|
|
|
|
|
|
"%s_status" % self.access_code, {
|
|
|
|
|
|
|
|
"type": "fear_tracker.invalidate_status",
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
async def fear_tracker_invalidate_status(self, event):
|
|
|
|
async def fear_tracker_invalidate_status(self, event):
|
|
|
|
no_hash_status = reverse('status',
|
|
|
|
no_hash_status = reverse('status',
|
|
|
|
kwargs={'access_code': self.access_code})
|
|
|
|
kwargs={'access_code': self.access_code})
|
|
|
|