Remember when a client connected
For the memes
This commit is contained in:
parent
5828892009
commit
63bd19cc11
1 changed files with 7 additions and 2 deletions
|
@ -5,7 +5,7 @@ import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import uuid
|
import uuid
|
||||||
from datetime import datetime
|
from datetime import datetime, timezone
|
||||||
from types import TracebackType
|
from types import TracebackType
|
||||||
from typing import Optional, Any, Type, Dict
|
from typing import Optional, Any, Type, Dict
|
||||||
|
|
||||||
|
@ -121,6 +121,7 @@ class Session(object):
|
||||||
connection_state: Optional[str]
|
connection_state: Optional[str]
|
||||||
pc: Optional[Any]
|
pc: Optional[Any]
|
||||||
connection_id: str
|
connection_id: str
|
||||||
|
connected_at: datetime
|
||||||
lock: asyncio.Lock
|
lock: asyncio.Lock
|
||||||
running: bool
|
running: bool
|
||||||
ended: bool
|
ended: bool
|
||||||
|
@ -136,9 +137,13 @@ class Session(object):
|
||||||
self.ended = False
|
self.ended = False
|
||||||
self.lock = asyncio.Lock()
|
self.lock = asyncio.Lock()
|
||||||
self.running = False
|
self.running = False
|
||||||
|
self.connected_at = datetime.now(timezone.utc)
|
||||||
|
|
||||||
def to_dict(self) -> Dict[str, str]:
|
def to_dict(self) -> Dict[str, str]:
|
||||||
return {"connection_id": self.connection_id}
|
return {
|
||||||
|
"connection_id": self.connection_id,
|
||||||
|
"connected_at": self.connected_at.strftime("%Y-%m-%dT%H:%M:%S%z")
|
||||||
|
}
|
||||||
|
|
||||||
async def activate(self) -> None:
|
async def activate(self) -> None:
|
||||||
print(self.connection_id, "Activating")
|
print(self.connection_id, "Activating")
|
||||||
|
|
Loading…
Reference in a new issue