|
@@ 361-375 (lines=15) @@
|
| 358 |
|
room_id = message[VarNames.ROOM_ID] |
| 359 |
|
self.add_channel(room_id) |
| 360 |
|
self.add_online_user(room_id) |
| 361 |
|
|
| 362 |
|
def send_client_delete_channel(self, message): |
| 363 |
|
room_id = message[VarNames.ROOM_ID] |
| 364 |
|
self.async_redis.unsubscribe((room_id,)) |
| 365 |
|
self.async_redis_publisher.hdel(room_id, self.id) |
| 366 |
|
self.channels.remove(room_id) |
| 367 |
|
|
| 368 |
|
def process_get_messages(self, data): |
| 369 |
|
""" |
| 370 |
|
:type data: dict |
| 371 |
|
""" |
| 372 |
|
header_id = data.get(VarNames.GET_MESSAGES_HEADER_ID, None) |
| 373 |
|
count = int(data.get(VarNames.GET_MESSAGES_COUNT, 10)) |
| 374 |
|
room_id = data[VarNames.CHANNEL] |
| 375 |
|
self.logger.info('!! Fetching %d messages starting from %s', count, header_id) |
| 376 |
|
if header_id is None: |
| 377 |
|
messages = Message.objects.filter(Q(room_id=room_id), Q(deleted=False)).order_by('-pk')[:count] |
| 378 |
|
else: |
|
@@ 459-470 (lines=12) @@
|
| 456 |
|
WebRtcRedisStates.RESPONDED, |
| 457 |
|
Actions.REPLY_CALL_CONNECTION, |
| 458 |
|
[WebRtcRedisStates.OFFERED], |
| 459 |
|
HandlerNames.WEBRTC_TRANSFER |
| 460 |
|
) |
| 461 |
|
|
| 462 |
|
def proxy_webrtc(self, in_message): |
| 463 |
|
""" |
| 464 |
|
:type in_message: dict |
| 465 |
|
""" |
| 466 |
|
connection_id = in_message[VarNames.CONNECTION_ID] |
| 467 |
|
channel = in_message.get(VarNames.WEBRTC_OPPONENT_ID) |
| 468 |
|
self_channel_status = self.sync_redis.shget(connection_id, self.id) |
| 469 |
|
opponent_channel_status = self.sync_redis.shget(connection_id, channel) |
| 470 |
|
if not (self_channel_status == WebRtcRedisStates.READY and opponent_channel_status == WebRtcRedisStates.READY): |
| 471 |
|
raise ValidationError('Error in connection status, your status is {} while opponent is {}'.format( |
| 472 |
|
self_channel_status, opponent_channel_status |
| 473 |
|
)) # todo receiver should only accept proxy_webrtc from sender, sender can accept all |