Move room format string to connection class
This commit is contained in:
parent
2da7155504
commit
7e1947bd04
1 changed files with 6 additions and 5 deletions
|
|
@ -6,10 +6,6 @@ from websocket import WebSocketException as WSException
|
||||||
|
|
||||||
from . import callbacks
|
from . import callbacks
|
||||||
|
|
||||||
|
|
||||||
ROOM_FORMAT = "wss://euphoria.io/room/{}/ws"
|
|
||||||
|
|
||||||
|
|
||||||
class Connection():
|
class Connection():
|
||||||
"""
|
"""
|
||||||
Stays connected to a room in its own thread.
|
Stays connected to a room in its own thread.
|
||||||
|
|
@ -24,13 +20,18 @@ class Connection():
|
||||||
- "stop"
|
- "stop"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, room, url_format=ROOM_FORMAT):
|
ROOM_FORMAT = "wss://euphoria.io/room/{}/ws"
|
||||||
|
|
||||||
|
def __init__(self, room, url_format=None):
|
||||||
"""
|
"""
|
||||||
room - name of the room to connect to
|
room - name of the room to connect to
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.room = room
|
self.room = room
|
||||||
|
|
||||||
|
if not url_format:
|
||||||
|
url_format = self.ROOM_FORMAT
|
||||||
self._url = url_format.format(self.room)
|
self._url = url_format.format(self.room)
|
||||||
|
|
||||||
self._stopping = False
|
self._stopping = False
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue