Skip to content

Instantly share code, notes, and snippets.

@Ibro
Last active November 17, 2017 06:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ibro/8f21b48a025c64dc5e0a7a62abed0c04 to your computer and use it in GitHub Desktop.
Save Ibro/8f21b48a025c64dc5e0a7a62abed0c04 to your computer and use it in GitHub Desktop.
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