signalr_flutter
signalr_flutter copied to clipboard
hubCallBack not working
I have .net backend. My flutter app connecting with it successfully even invoke method and send message to server. but hubCallBack not working following is my code snippet
void initiateSignalR() async { signalR = SignalR('http://10.0.2.2:27506', "ChatHub", hubMethods: ["Send"], statusChangeCallback: _onStatusChange, hubCallback: _onNewMessage);
}
_onStatusChange(dynamic status) { print("Status " + status); if (mounted) { setState(() { _signalRStatus = status as String; }); } }
_onNewMessage(String? methodName, dynamic message) { print("IN message received"); print('MethodName = $methodName, Message = $message'); }
_buttonTapped() async {
final res = await signalR.invokeMethod
merhaba; sunucu tarafındaki çağrıyı denemek için boş olarak gönderiyorsanız çalışmaz. SignalHub.Clients.Group(KullanıcıNo()).Mobil_TumListelerJson("BOŞ OLAMAZ")
this is my method in ChatHub
public string SendMsg(string name, string message) { // Call the broadcastMessage method to update clients. Clients.All.broadcastMessage(name, message);
return message;
}
On Wed, Jul 7, 2021 at 2:43 PM yenge35 @.***> wrote:
merhaba; sunucu tarafındaki çağrıyı denemek için boş olarak gönderiyorsanız çalışmaz. SignalHub.Clients.Group(KullanıcıNo()).Mobil_TumListelerJson("BOŞ OLAMAZ")
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/AS-Devs/signalr_flutter/issues/35#issuecomment-875435584, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACGJXHNDFNDHVEQ72H7Z7KLTWQLEDANCNFSM4754273Q .
bu .net için yazılmıştır. sizin proje core projesimi.
Try this.This works for me.
void initiateSignalR() async { signalR = SignalR('http://10.0.2.2:27506/', "ChatHub", hubMethods: ["broadcastMessage"], statusChangeCallback: _onStatusChange, hubCallback: _onNewMessage); }
this is my method in ChatHub public string SendMsg(string name, string message) { // Call the broadcastMessage method to update clients. Clients.All.broadcastMessage(name, message); return message; } … On Wed, Jul 7, 2021 at 2:43 PM yenge35 @.***> wrote: merhaba; sunucu tarafındaki çağrıyı denemek için boş olarak gönderiyorsanız çalışmaz. SignalHub.Clients.Group(KullanıcıNo()).Mobil_TumListelerJson("BOŞ OLAMAZ") — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#35 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACGJXHNDFNDHVEQ72H7Z7KLTWQLEDANCNFSM4754273Q .
Your method name in Hub is SendMsg
while in your flutter app you are invoking "send"
I am using everything normally in the debug environment. If I use it, I can connect to the server, but I cannot receive messages sent by the server. Have I encountered this situation?