Skip to content

Instantly share code, notes, and snippets.

@xximjasonxx

xximjasonxx/client.html

Last active May 2, 2020
Embed
What would you like to do?
<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
You can’t perform that action at this time.