回答編集履歴

1

文法の修正

2020/10/13 11:12

投稿

toast-uz
toast-uz

スコア3266

test CHANGED
@@ -26,15 +26,9 @@
26
26
 
27
27
  class Hoge:
28
28
 
29
- def __init__(self):
29
+ async def connect(self, uri):
30
30
 
31
- self.uri = 'ws://localhost:8000/'
32
-
33
-
34
-
35
- async def connect(self):
36
-
37
- self.ws : websockets.WebSocketCommonProtocol = await websockets.connect(self.uri)
31
+ self.ws : websockets.WebSocketCommonProtocol = await websockets.connect(uri)
38
32
 
39
33
 
40
34
 
@@ -56,7 +50,7 @@
56
50
 
57
51
  hoge = Hoge()
58
52
 
59
- await hoge.connect()
53
+ await hoge.connect('ws://localhost:8000/')
60
54
 
61
55
  async for msg in hoge:
62
56