• 大小: 1.33MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-03
  • 语言: 其他
  • 标签: SignaR  

资源简介

通过SignalR来实现聊天室的功能,服务器跟客户端都有,完整的参考例子

资源截图

代码片段和文件信息

using Microsoft.AspNetCore.SignalR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace SignalRChat.ChatHub
{
    public class MyChatHub:Hub
    {
        /// 
        /// 发送消息
        /// 

        /// 
        /// 
        /// 
        public async Task SendMessage(string userNamestring message)
        {
            await Clients.All.SendAsync(“SendMessage“userName message);
        }
        public override Task OnConnectedAsync()
        {
            return base.OnConnectedAsync();
        }
        public override Task OnDisconnectedAsync(Exception exception)
        {
            return base.OnDisconnectedAsync(exception);
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-08-15 17:09  SignalR-Project-master\
     文件        1062  2018-07-06 16:04  SignalR-Project-master\LICENSE
     文件         102  2018-07-06 16:04  SignalR-Project-master\README.md
     目录           0  2018-08-15 17:09  SignalR-Project-master\SignalR-Beginners\
     目录           0  2018-08-15 17:09  SignalR-Project-master\SignalR-Beginners\.vs\
     目录           0  2018-08-15 17:17  SignalR-Project-master\SignalR-Beginners\.vs\SignalRChat.Beginner1.0\
     目录           0  2018-08-15 17:17  SignalR-Project-master\SignalR-Beginners\.vs\SignalRChat.Beginner1.0\DesignTimeBuild\
     文件         512  2018-08-15 17:17  SignalR-Project-master\SignalR-Beginners\.vs\SignalRChat.Beginner1.0\DesignTimeBuild\.dtbcache
     目录           0  2018-08-15 17:10  SignalR-Project-master\SignalR-Beginners\.vs\SignalRChat.Beginner1.0\v15\
     文件       39424  2018-08-15 17:17  SignalR-Project-master\SignalR-Beginners\.vs\SignalRChat.Beginner1.0\v15\.suo
     目录           0  2018-08-15 17:09  SignalR-Project-master\SignalR-Beginners\.vs\SignalRChat.Beginner1.0\v15\Server\
     目录           0  2018-08-15 17:09  SignalR-Project-master\SignalR-Beginners\.vs\SignalRChat.Beginner1.0\v15\Server\sqlite3\
     文件           0  2018-08-15 17:09  SignalR-Project-master\SignalR-Beginners\.vs\SignalRChat.Beginner1.0\v15\Server\sqlite3\db.lock
     文件        4096  2018-08-15 17:09  SignalR-Project-master\SignalR-Beginners\.vs\SignalRChat.Beginner1.0\v15\Server\sqlite3\storage.ide
     文件       32768  2018-08-15 17:09  SignalR-Project-master\SignalR-Beginners\.vs\SignalRChat.Beginner1.0\v15\Server\sqlite3\storage.ide-shm
     文件     2080632  2018-08-15 17:17  SignalR-Project-master\SignalR-Beginners\.vs\SignalRChat.Beginner1.0\v15\Server\sqlite3\storage.ide-wal
     目录           0  2018-08-15 17:17  SignalR-Project-master\SignalR-Beginners\SignalRChat.Beginner1.0\
     文件         825  2018-07-06 16:04  SignalR-Project-master\SignalR-Beginners\SignalRChat.Beginner1.0\MyChatHub.cs
     目录           0  2018-08-15 17:09  SignalR-Project-master\SignalR-Beginners\SignalRChat.Beginner1.0\Pages\
     文件         174  2018-07-06 16:04  SignalR-Project-master\SignalR-Beginners\SignalRChat.Beginner1.0\Pages\About.cshtml
     文件         394  2018-07-06 16:04  SignalR-Project-master\SignalR-Beginners\SignalRChat.Beginner1.0\Pages\About.cshtml.cs
     文件         471  2018-07-06 16:04  SignalR-Project-master\SignalR-Beginners\SignalRChat.Beginner1.0\Pages\Contact.cshtml
     文件         380  2018-07-06 16:04  SignalR-Project-master\SignalR-Beginners\SignalRChat.Beginner1.0\Pages\Contact.cshtml.cs
     文件         849  2018-07-06 16:04  SignalR-Project-master\SignalR-Beginners\SignalRChat.Beginner1.0\Pages\Error.cshtml
     文件         633  2018-07-06 16:04  SignalR-Project-master\SignalR-Beginners\SignalRChat.Beginner1.0\Pages\Error.cshtml.cs
     文件        4779  2018-07-06 16:04  SignalR-Project-master\SignalR-Beginners\SignalRChat.Beginner1.0\Pages\Index.cshtml
     文件         322  2018-07-06 16:04  SignalR-Project-master\SignalR-Beginners\SignalRChat.Beginner1.0\Pages\Index.cshtml.cs
     文件         163  2018-07-06 16:04  SignalR-Project-master\SignalR-Beginners\SignalRChat.Beginner1.0\Pages\Privacy.cshtml
     文件         322  2018-07-06 16:04  SignalR-Project-master\SignalR-Beginners\SignalRChat.Beginner1.0\Pages\Privacy.cshtml.cs
     目录           0  2018-08-15 17:09  SignalR-Project-master\SignalR-Beginners\SignalRChat.Beginner1.0\Pages\Shared\
     文件        1835  2018-07-06 16:04  SignalR-Project-master\SignalR-Beginners\SignalRChat.Beginner1.0\Pages\Shared\_CookieConsentPartial.cshtml
............此处省略123个文件信息

评论

共有 条评论