using Microsoft.AspNet.SignalR;
using Signalr.common;//It is not available
namespace Chat_App.Hubs
{
public class ChatHub :Hub
{
public void Send(string name, string message)
{
// Call the addNewMessageToPage method to update clients.
Clients.All.addNewMessageToPage(name, message);
}
public void Connect(string userName)
{
var id = Context.ConnectionId;
if (ConnectedUsers.Count(x => x.ConnectionId == id) == 0)
{
ConnectedUsers.Add(new UserDetail { ConnectionId = id, UserName = userName });
// send to caller
Clients.Caller.onConnected(id, userName, ConnectedUsers, CurrentMessage);
// send to all except caller client
Clients.AllExcept(id).onNewUserConnected(id, userName);
}
}
我想要一个用于我的网站的聊天应用程序,我有信号器聊天室,但名称空间不可用,上面是信号器聊天应用程序的代码。