[rabbitmq-discuss] |Spam| Help for RabbitMQ-Web-Stomp
truelie
youpingl at sina.com
Wed Jun 13 07:32:22 BST 2012
I using queue replace for topic,but it still failed.
send.html:
<body lang="en">
<h1>Send Message</h1>
<script>
// Stomp.js boilerplate
WebSocketStompMock = SockJS;
var client = Stomp.client('http://127.0.0.1:55674/stomp');
client.connect("guest","guest",function(x){
document.write(x);
});
function send()
{
client.send('/queue/test', {}, document.form1.msg.val);
}
</script>
<form id="form1" method="post" name="form1" action=""">
input msg:<input id="msg" name="msg" type="text"/>
<input name="Submit" type="submit" onclick="send();" value="send">
</form>
</body>
recv.html:
<body>
<h1>Recv Message</h1>
<script>
// Stomp.js boilerplate
WebSocketStompMock = SockJS;
var client = Stomp.client('http://127.0.0.1:55674/stomp');
client.connect("guest","guest",function(x){
id = client.subscribe("/queue/test", function(d) {
document.write(d.body);
});
});
</script>
</body>
Best Regards!
2012-06-13 14:30:59
truelie
发件人: Matthias Radestock
发送时间: 2012-06-13 04:43:49
收件人: truelie
抄送: rabbitmq-discuss
主题: Re: |Spam| [rabbitmq-discuss] Help for RabbitMQ-Web-Stomp
On 12/06/12 03:00, truelie wrote:
> I am testing for RabbitMQ-Web-Stomp,which send or receive message
> from browser. [...] Now, I write a send.html to send message,and a
> recv.html to receive message,but not success.
I see you are using topics...
> client.send('/topic/test', {}, document.form1.msg.val);
> [...]
> id = client.subscribe("/topic/test", function(d) {
> document.write(d.body);
> });
Did you start the receiver before the sender? If not then the sent
message will be lost.
You may want to use a queue destination instead. And you should probably
read http://www.rabbitmq.com/stomp.html#d to gain a broader
understanding of the various kinds of destinations and their semantics.
Regards,
Matthias.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120613/39b8ed3c/attachment.htm>
More information about the rabbitmq-discuss
mailing list