Last active
June 12, 2018 15:30
-
-
Save ssougnez/e7bb04d5b2a4ae2196255540d045c8cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const connection = new signalR.HubConnectionBuilder() | |
.withUrl("/hub") | |
.build(); | |
connection.start().catch(err => document.write(err)); | |
connection.on("messageReceived", (username: string, message: string) => { | |
let m = document.createElement("div"); | |
m.innerHTML = `<div class="message__author">${username}</div><div>${message}</div>`; | |
divMessages.appendChild(m); | |
divMessages.scrollTop = divMessages.scrollHeight; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment