1
我可以發送消息 但我的OnReceiveMessage事件不會觸發?Xamarin + SignalR(發送可能,但不接收消息)
服務器端
public void Send(string name, string message, string roomname)
{
//All connected clients in a specified group
Clients.Group(roomname).OnMessageReceived(name, message);
}
Xamarin,我從chatpage
public ChatViewModel(List<MessageViewModel> messages)
{
Messages = new ObservableCollection<MessageViewModel>(messages);
_chatServices = DependencyService.Get<IChatServices>();
_Channel = "PrivateRoom";
_chatServices.Connect();
_chatServices.JoinRoom(_Channel);
_chatServices.OnMessageReceived += _chatServices_OnMessageReceived;
}
private void _chatServices_OnMessageReceived(object sender, ChatMessage e)
{
// NO TRIGGER
}
是否OnMessageReceived在客戶端上調用,如果服務器將其推送給所有客戶端(而不是僅僅是房間)? –
@AndrewTavera,似乎不得不啓用cors。 – Eli