Comments (4)
Don't know why it fails. Have you tried running it by using IIS and not IIS express? I used IIS locally.
from react-native-signalr.
Issue with the http://localhost:8888
connection = signalr.hubConnection('http://localhost:8888/');
Try with your network IP address and it will solve your issue.
windows command prompt (cmd) enter ipconfig
Example,
connection = signalr.hubConnection('http://192.168.1.20:8888/');
Also check followings,
- host SignalR in Local IIS not IIS Express
- enable Web Socket in IIS (Enable Windows Features > IIS)
from react-native-signalr.
I have the same error.
from react-native-signalr.
I have the same issue
package.json
"{
"name": "ChatApp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"react": "16.8.6",
"react-native": "0.60.5",
"react-native-signalr": "^1.0.6"
},
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/runtime": "^7.5.5",
"@react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"eslint": "^6.2.2",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"react-test-renderer": "16.8.6"
},
"jest": {
"preset": "react-native"
}
}"
App.js
import React, {Component} from 'react';
import {
SafeAreaView,
StyleSheet,
ScrollView,
View,
Text,
StatusBar,
} from 'react-native';
import signalr from "react-native-signalr";
class App extends Component{
constructor(props){
super(props)
};
componentDidMount() {
const hubUrl = 'http://localhost:82//signalr/hubs';
const connection = signalr.hubConnection("http://localhost:82/");
connection.url =hubUrl
connection.logging = true;
const proxy = connection.createHubProxy('chatHub');
proxy.on('broadcastChat', (result) => {
console.log('message-from-server', result);
});
// atempt connection, and handle errors
connection.start().done(() => {
console.log('Now connected, connection ID=' + connection.id);
proxy.invoke('getUsers')
.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((e) => {
console.log('connection',connection);
console.log('Failed',e);
});
//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 #14')
}
console.debug('SignalR error: ' + errorMessage, detailedError)
});
render()
{
console.log(this.state)
return (
);
};
}
}
export default App;
from react-native-signalr.
Related Issues (20)
- how can change state from on(event) HOT 1
- .NET core 2.0 support
- How is reconnection handled? HOT 3
- IOS - SignalR Connection break when app move in background. HOT 4
- Does it support Net Core 2.1 or later?
- get 'undefined' from server in invoke
- cannot receive message HOT 1
- Timer Error HOT 1
- Try specifying a different transport or none at all for auto initialization.
- How to send token or other data HOT 3
- Signal R not working with ANDROID STORE VERSION
- Unable to call signalR method
- Replace deprecated dependency ms-signalr-client HOT 1
- Failed - Error: Error during negotiation request. HOT 3
- Autoreconnect feature HOT 1
- TypeError: Cannot set property userAgent of #<Navigator> which has only a getter HOT 1
- hello
- Forgotten Package
- On Screen Change, Event Is Still fired HOT 7
- is this lib dead? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-signalr.