示例#1
0
文件: chat.py 项目: 0790486/umundo
    def welcome(self, publisher, nodeId, subId):
        try:
            welcomeMsg = ChatMsg()
            welcomeMsg.username = self.username
            welcomeMsg.type = ChatMsg.JOINED

            greeting = self.publisher.prepareMessage("ChatMsg", welcomeMsg)
            greeting.setReceiver(subId)
            greeting.putMeta("subscriber", self.subscriber.getUUID())
            self.publisher.send(greeting)
        except BaseException as e:
            traceback.print_exc(file=sys.stdout)
示例#2
0
文件: chat.py 项目: zengjie/umundo
    def welcome(self, publisher, nodeId, subId):
        try:
            welcomeMsg = ChatMsg()
            welcomeMsg.username = self.username
            welcomeMsg.type = ChatMsg.JOINED

            greeting = self.publisher.prepareMessage("ChatMsg", welcomeMsg)
            greeting.setReceiver(subId)
            greeting.putMeta("subscriber", self.subscriber.getUUID())
            self.publisher.send(greeting)
        except BaseException as e:
            traceback.print_exc(file=sys.stdout)
示例#3
0
文件: chat.py 项目: 0790486/umundo

username = raw_input("Your username: "******"s11nChat", chatRcv)
chatPub = umundoS11n.TypedPublisher("s11nChat")
chatGrt = ChatGreeter(chatPub, chatSub, username, participants)

chatSub.registerType("ChatMsg", ChatMsg)
#chatPub.setGreeter(chatGrt)

node = umundo.Node()
node.addPublisher(chatPub)
node.addSubscriber(chatSub)

print("Start typing messages (empty line to quit):")

while True:
    inputmsg = raw_input("")
    if inputmsg == "":
        node.removePublisher(chatPub)
        node.removeSubscriber(chatSub)
        break

    msg = ChatMsg()
    msg.username = username
    msg.message = inputmsg
    chatPub.sendObject("ChatMsg", msg)
示例#4
0
文件: chat.py 项目: zengjie/umundo

username = raw_input("Your username: "******"s11nChat", chatRcv)
chatPub = umundoS11n.TypedPublisher("s11nChat")
chatGrt = ChatGreeter(chatPub, chatSub, username, participants)

chatSub.registerType("ChatMsg", ChatMsg)
#chatPub.setGreeter(chatGrt)

node = umundo.Node()
node.addPublisher(chatPub)
node.addSubscriber(chatSub)

print("Start typing messages (empty line to quit):")

while True:
    inputmsg = raw_input("")
    if inputmsg == "":
        node.removePublisher(chatPub)
        node.removeSubscriber(chatSub)
        break

    msg = ChatMsg()
    msg.username = username
    msg.message = inputmsg
    chatPub.sendObject("ChatMsg", msg)