"use strict";

var connection = new signalR.HubConnectionBuilder().withUrl("/umbraco/serverEventHub", { accessTokenFactory: () => "YOUR-ACCESS-TOKEN-HERE" }).build();


connection.on("notify", function (payload) {
  var li = document.createElement("li");
  document.getElementById("messagesList").appendChild(li);

  li.textContent = `${payload.eventSource} ${payload.eventType} with key: ${payload.key}`;
});

connection.start().then(function () {
}).catch(function (err) {
  return console.error(err.toString());
});
