Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
"use strict";
var connection = new signalR.HubConnectionBuilder()
connection.on("ReceiveMessage", function(message) {
var msg = message.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
var div = document.createElement("div");
div.innerHTML = msg + "<hr/>";
connection.start().catch(function(err) {
return console.error(err.toString());
document.getElementById("sendButton").addEventListener("click", function(event) {
var message = document.getElementById("message").value;
connection.invoke("SendMessageToAll", message).catch(function (err) {
return console.error(err.toString());
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.