Instantly share code, notes, and snippets.

@Ibro /Chat.jsx
Last active Nov 17, 2017

Embed
What would you like to do?
ASP.NET Core SignalR chat with React.js - https://codingblast.com/asp-net-core-signalr-chat-react
componentDidMount = () => {
const nick = window.prompt('Your name:', 'John');
const hubConnection = new HubConnection('http://localhost:5000/chat');
this.setState({ hubConnection, nick }, () => {
this.state.hubConnection
.start()
.then(() => console.log('Connection started!'))
.catch(err => console.log('Error while establishing connection :('));
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment