Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. this.hubConnection
  2. .start()
  3. .then(() => console.log('Connection started!'))
  4. .catch(err => console.log('Error while establishing connection :('));
  5.  
  6. this.hubConnection.on('ReceiveMessage', (userId: string, message: string) => {
  7. const text = `${userId}: ${message}`;
  8. this.messages.push(text);
  9. });
  10.  
  11. this.hubConnection
  12. .invoke('SendMessage', 'john', 'hello world')
  13. .catch(err => console.error(err));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement