Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Uncaught (in promise) Error: Failed to invoke 'XXXXX' due to an error on the server

$
0
0
<div class="post-text" itemprop="text">

I created a .net core chat application using SignalR and I used WebRTC for video calls. As I need to send the SDP to the receiver using server method so I created a hub method call "SendOffer". When I click Video call button I have invoked this "SendOffer" method. I have put the client side code below

var connection =new signalR.HubConnectionBuilder().withUrl('/chat').build();constPeer=newRTCPeerConnection();const video = document.querySelector('video');const constraints ={'video':true,'audio':true}

document.getElementById("sendVideo").addEventListener("click",function(event){

    navigator.mediaDevices.getUserMedia({
        video:true,
        audio:true,}).then(function(stream){
        video.srcObject = stream
        video.play();//Peer.addStream(stream);Peer.createOffer().then(sdp =>Peer.setLocalDescription(sdp)).then(function(){
                console.log(Peer.localDescription);//connection.invoke("SendOffer", Peer.localDescription).catch(function (err) {//    return console.error(err.toString());
                connection.invoke("SendOffer",Peer.localDescription);})});})

But this gives an error in the console log and not working. blow is the error

signalr.js:2088 Uncaught (in promise) Error: Failed to invoke 'SendOffer' due to an error on the server. at _this.callbacks. (signalr.js:2088) at HubConnection.processIncomingData (signalr.js:2182) at WebSocketTransport.HubConnection.connection.onreceive (signalr.js:1905) at WebSocket.webSocket.onmessage (signalr.js:3949)

Can any one please help me to solve this error.

</div>

Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>