初始化
This commit is contained in:
59
WebApplication1/Views/Home/Index.cshtml
Normal file
59
WebApplication1/Views/Home/Index.cshtml
Normal file
@@ -0,0 +1,59 @@
|
||||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
}
|
||||
<script src="~/js/jquery.min.js"></script>
|
||||
<script src="~/js/jquery.js"></script>
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Welcome</h1>
|
||||
<p>Learn about <a href="https://learn.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
|
||||
</div>
|
||||
<script src="~/lib/microsoft/signalr/dist/browser/signalr.js"></script>
|
||||
<script src="~/lib/microsoft/signalr/dist/browser/signalr.min.js"></script>
|
||||
<div id="events"></div>
|
||||
@* <script type="text/javascript">
|
||||
$(function()
|
||||
{
|
||||
|
||||
var connection = new signalR.HubConnectionBuilder().withUrl("/tongzhi").build();
|
||||
|
||||
connection.on("ReceiveMessage", function (message) {
|
||||
// 处理收到的消息
|
||||
console.log(message);
|
||||
});
|
||||
|
||||
connection.start().then(function () {
|
||||
console.log("11111111111");
|
||||
// 连接成功
|
||||
}).catch(function (error) {
|
||||
console.log("2222222222222");
|
||||
// 连接失败
|
||||
});
|
||||
|
||||
$("#aa").click(function()
|
||||
{
|
||||
await connection.invoke("SendMessage", "1111111111", "你好").catch(function (err) {
|
||||
return console.error(err.toString());
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
</script> *@
|
||||
|
||||
<h1>Server Status</h1>
|
||||
<div id="status">
|
||||
<p>Loading...</p>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const eventSource = new EventSource('/api/home/StreamSSEvents');
|
||||
|
||||
eventSource.onmessage = function (event) {
|
||||
console.log(event.data);
|
||||
document.getElementById('status').innerHTML = event.data;
|
||||
};
|
||||
|
||||
eventSource.onerror = function (error) {
|
||||
console.error("Error occurred: ", error);
|
||||
};
|
||||
</script>
|
||||
6
WebApplication1/Views/Home/Privacy.cshtml
Normal file
6
WebApplication1/Views/Home/Privacy.cshtml
Normal file
@@ -0,0 +1,6 @@
|
||||
@{
|
||||
ViewData["Title"] = "Privacy Policy";
|
||||
}
|
||||
<h1>@ViewData["Title"]</h1>
|
||||
|
||||
<p>Use this page to detail your site's privacy policy.</p>
|
||||
Reference in New Issue
Block a user