点击发送按钮触发,消息发不出去
controller:
var ws = new WebSocket("ws://121.43.160.149:8890/ws/phone/message");
var chatMessage = {
messagetxt : $scope.mmm,
touserid : thisId
}
var sMsg = {
messageContext : chatMessage,
messageType : "friendChat"
}
console.log(sMsg);
ws.onopen = function(e){
ws.send(JSON.stringify(sMsg));
}
请问angularjs在用webSocket时应该怎么用?