點擊發送按鈕觸發,訊息發不出去
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時該怎麼用?