【发布时间】:2015-09-27 13:06:03
【问题描述】:
我正在使用Spring Websocket Plugin,我想向客户端发送一些日志记录输出。
这是我的代码:
@MessageMapping("/run")
@SendTo("/topic/run")
protected String run(@Payload WebForm form) {
doSomeWithForm(form)
return "started"
}
普惠制:
$(function () {
var socket = new SockJS("${createLink(uri: '/stomp')}");
var client = Stomp.over(socket);
client.connect({}, function () {
client.subscribe("/topic/run", function (message) {
$("#log").append(message.body);
});
});
$("#submitBtn").click(function() {
client.send("/app/run", {}, JSON.stringify({
'type':$("#type").val(),
'id':$("#id").val()
}));
});
});
目前为止运行良好,但 message.body 看起来像 ""This my return text""。
为什么有两个“?我怎样才能提取这个?
【问题讨论】: