Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed - Error: Error during negotiation request. #59

Open
gilshaan opened this issue Sep 1, 2020 · 3 comments
Open

Failed - Error: Error during negotiation request. #59

gilshaan opened this issue Sep 1, 2020 · 3 comments

Comments

@gilshaan
Copy link

gilshaan commented Sep 1, 2020

Error

Failed - Error: Error during negotiation request.
    at Object.error (jquery.signalR.js:179)
    at onFailed (jquery.signalR.js:652)
    at Object.error (jquery.signalR.js:672)
    at EventTarget.request.onreadystatechange (ajax.js:23)
    at EventTarget.dispatchEvent (event-target-shim.js:818)
    at EventTarget.setReadyState (XMLHttpRequest.js:592)
    at EventTarget.__didCompleteResponse (XMLHttpRequest.js:395)
    at XMLHttpRequest.js:508
    at RCTDeviceEventEmitter.emit (EventEmitter.js:189)
    at MessageQueue.__callFunction (MessageQueue.js:416)
jquery.signalR.js:82 [13:01:40 GMT+0530 (India Standard Time)] SignalR: Stopping connection.

My Code

componentDidMount() {
    //This is the server under /example/server published on azure.
    const connection = signalr.hubConnection('https://react-native-signalr.olofdahlbom.se');
    connection.logging = true;

    const proxy = connection.createHubProxy('chatHub');
    //receives broadcast messages from a hub function, called "helloApp"
    proxy.on('helloApp', (argOne, argTwo, argThree, argFour) => {
      console.log('message-from-server', argOne, argTwo, argThree, argFour);
      //Here I could response by calling something else on the server...
    });

    // atempt connection, and handle errors
    connection.start().done(() => {
      console.log('Now connected, connection ID=' + connection.id);

      proxy.invoke('helloServer', 'Hello Server, how are you?')
        .done((directResponse) => {
          console.log('direct-response-from-server', directResponse);
        }).fail(() => {
          console.warn('Something went wrong when calling server, it might not be up and running?')
        });

    }).fail(() => {
      console.log('Failed');
    });

    //connection-handling
    connection.connectionSlow(() => {
      console.log('We are currently experiencing difficulties with the connection.')
    });

    connection.error((error) => {
      const errorMessage = error.message;
      let detailedError = '';
      if (error.source && error.source._response) {
        detailedError = error.source._response;
      }
      if (detailedError === 'An SSL error has occurred and a secure connection to the server cannot be made.') {
        console.log('When using react-native-signalr on ios with http remember to enable http in App Transport Security https://github.com/olofd/react-native-signalr/issues/14')
      }
      console.debug('SignalR error: ' + errorMessage, detailedError)
    });
  }
@GhayoorUlHaq
Copy link

Same issue

@GhayoorUlHaq
Copy link

GhayoorUlHaq commented Sep 3, 2020

I think https://react-native-signalr.olofdahlbom.se is not working that's why getting this.

@amir-gorji
Copy link

This package is outdated and it's not working out with the latest signalR functionalities.
You can use @aspnet/signalr.
It's an official package working also on the React Native.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants