braverhealth / phoenix-socket-dart

Cross-platform and stream-based implementation of Phoenix Sockets
https://pub.dev/packages/phoenix_socket
BSD 3-Clause "New" or "Revised" License
73 stars 37 forks source link

Can't push event on a PhoenixChannelState.errored channel #83

Closed tovidd closed 2 months ago

tovidd commented 3 months ago

Got this error PhoenixChannelState.errored when channel push. It's about 6 from 10 messages failed to push to the channel.

phoenix_socket: ^0.7.4

I/flutter (14107): Bad state: Can't push event on a PhoenixChannelState.errored channel
I/flutter (14107): #0      PhoenixChannel.pushEvent (package:phoenix_socket/src/channel.dart:286:9)
I/flutter (14107): #1      PhoenixChannel.push (package:phoenix_socket/src/channel.dart:256:7)
I/flutter (14107): #2      _MyPageState._channelPush (package:******/my_page.dart:664:16)
I/flutter (14107): #3      _MyPageState._sendMessage (package:*****/my_page.dart:658:7)
I/flutter (14107): #4      _MyPageState.build.<anonymous closure> (package:****/my_page.dart:216:15)
I/flutter (14107): #5      _MyFAB.build.<anonymous closure> (package:******/my_component.dart:74:48)
I/flutter (14107): #6      EditableTextState._finalizeEditing (package:flutter/src/widgets/editable_text.dart:3245:18)
I/flutter (14107): #7      EditableTextState.performAction (package:flutter/src/widgets/editable_text.dart:3076:9)
I/flutter (14107): #8      TextInput._handleTextInputInvocation (package:flutter/src/services/text_input.dart:1876:39)
I/flutter (14107): #9      TextInput._loudlyHandleTextInputInvocation (package:flutter/src/service
flutter doctor -v [!] Flutter (Channel [user-branch], 3.16.3, on macOS 14.4.1 23E224 darwin-arm64, locale en-ID) ! Flutter version 3.16.3 on channel [user-branch] at /Users/username/flutter Currently on an unknown channel. Run `flutter channel` to switch to an official channel. If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install. ! Upstream repository unknown source is not a standard remote. Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error. • Framework revision b0366e0a3f (6 months ago), 2023-12-05 19:46:39 -0800 • Engine revision 54a7145303 • Dart version 3.2.3 • DevTools version 2.28.4 • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades. [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) • Android SDK at /Users/username/Library/Android/sdk • Platform android-34, build-tools 33.0.2 • ANDROID_HOME = /Users/username/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15E204a • CocoaPods version 1.14.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2022.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • android-studio-dir = /Applications/Android Studio.app • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) [✓] VS Code (version 1.89.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension can be installed from: 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter [✓] Connected device (2 available) • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 13 (API 33) (emulator) • Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.62 [✓] Network resources • All expected network resources are available. ! Doctor found issues in 1 category.
matehat commented 3 months ago

This usually means the channel flipped to an errored state following an error and it's subsequently unusable.

When such an error happens on a channel, you would see it emitted from the channel.messages stream.

tovidd commented 3 months ago

What option that i have if PhoenixChannelState.errored happened ? can channel resend or waiting until it ready to push again ?

This emitted from channel.message Message(joinRef: 116, ref: 116, topic: myTopic, event: PhoenixChannelEvent(phx_error), payload: {})

tovidd commented 3 months ago

Found why it's error, i was create a chat room that able to send text/image message. The room also push online status every 3.5 with the same topic. It turns out that sending messages and sending online status occur simultaneously.

Any solution about this ? thanks