angular.js - angularjs用websocket做聊天功能发送不出去消息
仅有的幸福
仅有的幸福 2017-05-15 17:05:37
0
1
570

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

仅有的幸福
仅有的幸福

Antworte allen(1)
为情所困

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

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage