Last active
May 2, 2020 18:07
-
-
Save xximjasonxx/61b7dda31e848567b3f7ebb15068c936 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
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@aspnet/signalr@1.1.0/dist/browser/signalr.min.js"></script> | |
<script type="text/javascript"> | |
document.addEventListener('DOMContentLoaded', function () { | |
var connection = new signalR.HubConnectionBuilder() | |
.withUrl('https://func.azurewebsites.net/api') | |
.configureLogging(signalR.LogLevel.Information) | |
.build(); | |
// Create a function that the hub can call to broadcast messages. | |
connection.on('newFirstLetterData', (name, message) => { | |
$("#reportOutput").append(`<div class="entry">${JSON.stringify(message)}</div>`); | |
}); | |
connection.start() | |
.then(() => { | |
alert("connected"); | |
}) | |
.catch((error) => { | |
alert("connection failed"); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment