def open(self):
"""Called when a websocket connection is initiated."""
# print some info about the opened connection
print("WebSocket opened",
"from user at {}".format(self.request.remote_ip))
# add this connection to the set of active connections
client_connections.add(self)
# assign a random not-too-light colour
self.color = '#'
for i in range(3):
self.color += hex(random.randint(0,13))[2:]
# assign a nickname
self.nickname = str(self.request.remote_ip)
评论列表
文章目录