suchen

Heim  >  Fragen und Antworten  >  Hauptteil

angular.js - angularjs用websocket做聊天功能发送不出去消息

点击发送按钮触发,消息发不出去
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时应该怎么用?

仅有的幸福仅有的幸福2744 Tage vor567

Antworte allen(1)Ich werde antworten

  • 为情所困

    为情所困2017-05-15 17:07:37

    直接看github上的资料,里面就有详细说明的
    https://github.com/AngularCla...

    Antwort
    0
  • StornierenAntwort