Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.hubConnection
- .start()
- .then(() => console.log('Connection started!'))
- .catch(err => console.log('Error while establishing connection :('));
- this.hubConnection.on('ReceiveMessage', (userId: string, message: string) => {
- const text = `${userId}: ${message}`;
- this.messages.push(text);
- });
- this.hubConnection
- .invoke('SendMessage', 'john', 'hello world')
- .catch(err => console.error(err));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement