websocket: change 'all-channelids' to 'channelids'
Yeah, names are easier to work with when they're also valid identifiers.
This commit is contained in:
parent
f606207163
commit
aa8f714a48
|
@ -27,8 +27,8 @@ from autobahn.twisted import websocket
|
|||
# motd: all clients display message, then continue normally
|
||||
# error: all clients display mesage, then terminate with error
|
||||
# -> {type: "bind", appid:, side:}
|
||||
# -> {type: "list"} -> all-channelids
|
||||
# <- {type: "all-channelids", channelids: [int..]}
|
||||
# -> {type: "list"} -> channelids
|
||||
# <- {type: "channelids", channelids: [int..]}
|
||||
# -> {type: "allocate"} -> allocated
|
||||
# <- {type: "allocated", channelid: int}
|
||||
# -> {type: "claim", channelid: int}
|
||||
|
@ -117,7 +117,7 @@ class WebSocketRendezvous(websocket.WebSocketServerProtocol):
|
|||
|
||||
def handle_list(self):
|
||||
channelids = sorted(self._app.get_allocated())
|
||||
self.send("all-channelids", channelids=channelids)
|
||||
self.send("channelids", channelids=channelids)
|
||||
|
||||
def handle_allocate(self):
|
||||
if self._channel:
|
||||
|
|
|
@ -525,7 +525,7 @@ class WebSocketAPI(ServerBase, unittest.TestCase):
|
|||
self.assertEqual(app.get_allocated(), set())
|
||||
c1.send(u"list")
|
||||
msg = yield c1.next_event()
|
||||
self.assertEqual(msg["type"], u"all-channelids")
|
||||
self.assertEqual(msg["type"], u"channelids")
|
||||
self.assertEqual(msg["channelids"], [])
|
||||
|
||||
c1.send(u"allocate")
|
||||
|
@ -539,7 +539,7 @@ class WebSocketAPI(ServerBase, unittest.TestCase):
|
|||
|
||||
c1.send(u"list")
|
||||
msg = yield c1.next_event()
|
||||
self.assertEqual(msg["type"], u"all-channelids")
|
||||
self.assertEqual(msg["type"], u"channelids")
|
||||
self.assertEqual(msg["channelids"], [cid])
|
||||
|
||||
c1.send(u"deallocate")
|
||||
|
@ -550,7 +550,7 @@ class WebSocketAPI(ServerBase, unittest.TestCase):
|
|||
|
||||
c1.send(u"list")
|
||||
msg = yield c1.next_event()
|
||||
self.assertEqual(msg["type"], u"all-channelids")
|
||||
self.assertEqual(msg["type"], u"channelids")
|
||||
self.assertEqual(msg["channelids"], [])
|
||||
|
||||
@inlineCallbacks
|
||||
|
@ -585,12 +585,12 @@ class WebSocketAPI(ServerBase, unittest.TestCase):
|
|||
|
||||
c1.send(u"list")
|
||||
msg = yield c1.next_event()
|
||||
self.assertEqual(msg["type"], u"all-channelids")
|
||||
self.assertEqual(msg["type"], u"channelids")
|
||||
self.assertEqual(msg["channelids"], [cid])
|
||||
|
||||
c2.send(u"list")
|
||||
msg = yield c2.next_event()
|
||||
self.assertEqual(msg["type"], u"all-channelids")
|
||||
self.assertEqual(msg["type"], u"channelids")
|
||||
self.assertEqual(msg["channelids"], [cid])
|
||||
|
||||
c1.send(u"deallocate")
|
||||
|
@ -605,7 +605,7 @@ class WebSocketAPI(ServerBase, unittest.TestCase):
|
|||
|
||||
c2.send(u"list")
|
||||
msg = yield c2.next_event()
|
||||
self.assertEqual(msg["type"], u"all-channelids")
|
||||
self.assertEqual(msg["type"], u"channelids")
|
||||
self.assertEqual(msg["channelids"], [])
|
||||
|
||||
@inlineCallbacks
|
||||
|
|
Loading…
Reference in New Issue
Block a user