本文整理汇总了Python中Command.Command.create方法的典型用法代码示例。如果您正苦于以下问题:Python Command.create方法的具体用法?Python Command.create怎么用?Python Command.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Command.Command
的用法示例。
在下文中一共展示了Command.create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: disconnect
# 需要导入模块: from Command import Command [as 别名]
# 或者: from Command.Command import create [as 别名]
def disconnect(client):
try:
# remove it from the list
ConnectionsManager.clients.remove(client)
# close the socket listening
client.socket.close()
# broadcast the disconnexion
message=Command.create(command=Command.LOGOUT,id=str(client.id))
ConnectionsManager.broadcast(message)
print("disconnection of "+repr(client.address))
print(ConnectionsManager.clientSize())
except ValueError:
print('noting to disconnect or already disconnected')
示例2: sendList
# 需要导入模块: from Command import Command [as 别名]
# 或者: from Command.Command import create [as 别名]
def sendList(self):
message=Command.create(command=Command.USERLIST,users=ConnectionsManager.getJsonList())
ConnectionsManager.sendTo(message,client=self)
示例3: sendRefresh
# 需要导入模块: from Command import Command [as 别名]
# 或者: from Command.Command import create [as 别名]
def sendRefresh(self):
message=Command.create(command=Command.REFRESH,user=self.publicRepresentation())
ConnectionsManager.broadcast(message)
示例4: sendMessage
# 需要导入模块: from Command import Command [as 别名]
# 或者: from Command.Command import create [as 别名]
def sendMessage(self,message,senderId):
message=Command.create(command=Command.WRITE,senderid=str(senderId),content=message)
print("@"+str(self.id)+" "+message)
ConnectionsManager.sendTo(message,client=self)