Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot receive messages from server to my flutter apps #42

Closed
rsyd29 opened this issue Dec 20, 2021 · 2 comments
Closed

Cannot receive messages from server to my flutter apps #42

rsyd29 opened this issue Dec 20, 2021 · 2 comments

Comments

@rsyd29
Copy link

rsyd29 commented Dec 20, 2021

I need help to solve my problem with my program code. When I create a new message and receive a message from the server an error occurs. When sending a message successfully entered the server, but when receiving a message from a different client the Flutter application could not receive it with an error message:

I/flutter (12014): statusChangeCallback: ConnectionStatus.connectionError
I/flutter (12014): value:
I/flutter (12014): response: null
I/TextInputPlugin(12014): Composing region changed by the framework. Restarting the input method.

======== Exception caught by services library ======================================================
The following PlatformException was thrown during a platform message callback:
PlatformException(channel-error, The handler has 1 parameters, but there are 2 values., null, null)

When the exception was thrown, this was the stack:
#0 SignalR.onStatusChange (package:signalr_flutter/signalr_flutter.dart:46:7)
#1 SignalRPlatformApi.setup. (package:signalr_flutter/signalr_api.dart:277:21)
#2 SignalRPlatformApi.setup. (package:signalr_flutter/signalr_api.dart:270:35)
#3 BasicMessageChannel.setMessageHandler. (package:flutter/src/services/platform_channel.dart:77:49)
#4 BasicMessageChannel.setMessageHandler. (package:flutter/src/services/platform_channel.dart:76:47)
#5 _DefaultBinaryMessenger.setMessageHandler. (package:flutter/src/services/binding.dart:389:35)
#6 _DefaultBinaryMessenger.setMessageHandler. (package:flutter/src/services/binding.dart:386:46)
#7 _invoke2. (dart:ui/hooks.dart:189:15)
#11 _invoke2 (dart:ui/hooks.dart:188:10)
#12 _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:42:5)
#13 _Channel.push (dart:ui/channel_buffers.dart:132:31)
#14 ChannelBuffers.push (dart:ui/channel_buffers.dart:329:17)
#15 PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:544:22)
#16 _dispatchPlatformMessage (dart:ui/hooks.dart:83:31)
(elided 3 frames from dart:async)

Flutter Code Initial Connection
image
image

Flutter Code Method sendMessage
image

.Net Server Code
image

@rsyd29
Copy link
Author

rsyd29 commented Dec 30, 2021

The issue has been resolved. The method Send method in the ChatHub class has one argument/parameter with a String data type. To be able to retrieve more than one data, use Map<String, dynamic> to String.

This is my code to learn what i mean
Code Flutter
Code .Net Framework

@rsyd29 rsyd29 closed this as completed Jan 29, 2022
@gongwangjie
Copy link

Everything works fine in the debug environment. If you use the release version, you can connect to the server but cannot receive messages sent by the server. Have you encountered this situation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants