我正在尝试为我们的ejabberd集群编写一个快速的负载测试脚本,它只需登录到一个聊天室,发布一些随机消息,然后退出。
我们尝试使用tsung进行这个特定的测试,但根据作者的说法,muc功能未包含在此版本中。
pyxmpp似乎具有此功能,但是如果我无法弄清楚如何使其工作。希望有人可以快速解释如何构建客户端并加入/发布到多用户聊天室。
谢谢!
我正在尝试为我们的ejabberd集群编写一个快速的负载测试脚本,它只需登录到一个聊天室,发布一些随机消息,然后退出。
我们尝试使用tsung进行这个特定的测试,但根据作者的说法,muc功能未包含在此版本中。
pyxmpp似乎具有此功能,但是如果我无法弄清楚如何使其工作。希望有人可以快速解释如何构建客户端并加入/发布到多用户聊天室。
谢谢!
Hey I stumbled over your question a few times, while trying the same thing. Here is my answer:
Using http://pyxmpp.jajcus.net/svn/pyxmpp/trunk/examples/echobot.py 作为迅速启动,你必须做的是进口MUC-Stuff。
from pyxmpp.jabber.muc import MucRoomState, MucRoomManager
一旦您的客户端已连接,您就可以连接到您的房间:
def session_started(self):
"""Handle session started event. May be overriden in derived classes.
This one requests the user s roster and sends the initial presence."""
print u SESSION STARTED
self.request_roster()
p=Presence()
self.stream.send(p)
print u ConnectToParty
self.connectToMUC()
def connectToMUC(self):
self.roomManager = MucRoomManager(self.stream);
self.roomHandler = MucRoomHandler()
self.roomState = self.roomManager.join(
room=JID( room@conference.server.domain ),
nick= PartyBot ,
handler=self.roomHandler,
history_maxchars=0,
password = None)
self.roomManager.set_handlers()
发送消息,你所需做的只是调用self.roomState.send_message("发送此消息")。
做事情,继承自MucRoomHandler并对事件作出反应。请注意,将“set_handlers()”传递给roomManager非常重要,否则回调将不被调用。
Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...
I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...
Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...
Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...
I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...
Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...
Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...
I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...