WahidNasri / flutter-mqtt-chat-client

A Chat app developed with Flutter, it uses MQTT protocol
GNU General Public License v3.0
146 stars 34 forks source link

Registering a user #1

Closed staminna closed 2 years ago

staminna commented 3 years ago

Hi WahidNasri,

I can't find out how to register a user.

After building the app, here is the terminal output (sorry it seems a bit long)

$ flutter run ...

`πŸ’ͺ Running with sound null safety πŸ’ͺ

An Observatory debugger and profiler on SM G991B is available at: http://127.0.0.1:54479/_RRjKnM55QU=/ The Flutter DevTools debugger and profiler on SM G991B is available at: http://127.0.0.1:54488?uri=http%3A%2F%2F127.0.0.1%3A54479%2F_RRjKnM55QU%3D%2F I/ViewRootImpl@ea15fdfMainActivity: ViewPostIme pointer 0 I/ViewRootImpl@ea15fdfMainActivity: ViewPostIme pointer 1 I/ViewRootImpl@ea15fdfMainActivity: ViewPostIme pointer 0 I/ViewRootImpl@ea15fdfMainActivity: ViewPostIme pointer 1 I/ViewRootImpl@ea15fdfMainActivity: ViewPostIme pointer 0 I/ViewRootImpl@ea15fdfMainActivity: ViewPostIme pointer 1 I/ViewRootImpl@ea15fdfMainActivity: ViewPostIme pointer 0 I/ViewRootImpl@ea15fdfMainActivity: ViewPostIme pointer 1 D/InputMethodManager(12701): SSI - flag : 0 Pid : 12701 view : com.example.flutter_mqtt D/InputMethodManager(12701): view is not EditText D/InputMethodManager(12701): prepareNavigationBarInfo() DecorView@b50f53d[MainActivity] D/InputMethodManager(12701): getNavigationBarColor() -855310 V/InputMethodManager(12701): Starting input: tba=com.example.flutter_mqtt ic=io.flutter.plugin.editing.InputConnectionAdaptor@22a1f65 mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false D/InputMethodManager(12701): startInputInner - Id : 0 I/InputMethodManager(12701): startInputInner - mService.startInputOrWindowGainedFocus D/InputTransport(12701): Input channel constructed: 'ClientS', fd=116 D/InputTransport(12701): Input channel destroyed: 'ClientS', fd=109 D/InputMethodManager(12701): prepareNavigationBarInfo() DecorView@b50f53d[MainActivity] D/InputMethodManager(12701): getNavigationBarColor() -855310 D/InputMethodManager(12701): prepareNavigationBarInfo() DecorView@b50f53d[MainActivity] D/InputMethodManager(12701): getNavigationBarColor() -855310 V/InputMethodManager(12701): Starting input: tba=com.example.flutter_mqtt ic=io.flutter.plugin.editing.InputConnectionAdaptor@5efb8eb mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false D/InputMethodManager(12701): startInputInner - Id : 0 I/InputMethodManager(12701): startInputInner - mService.startInputOrWindowGainedFocus D/InputTransport(12701): Input channel constructed: 'ClientS', fd=115 D/InputTransport(12701): Input channel destroyed: 'ClientS', fd=116 W/IInputConnectionWrapper(12701): getExtractedText on inactive InputConnection W/IInputConnectionWrapper(12701): getTextBeforeCursor on inactive InputConnection W/IInputConnectionWrapper(12701): getExtractedText on inactive InputConnection W/IInputConnectionWrapper(12701): getTextBeforeCursor on inactive InputConnection W/IInputConnectionWrapper(12701): getExtractedText on inactive InputConnection W/IInputConnectionWrapper(12701): getTextBeforeCursor on inactive InputConnection E/SpannableStringBuilder(12701): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length E/SpannableStringBuilder(12701): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length E/SpannableStringBuilder(12701): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length E/SpannableStringBuilder(12701): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length D/InsetsSourceConsumer(12701): setRequestedVisible: visible=true, type=13, host=com.example.flutter_mqtt/com.example.flutter_mqtt.MainActivity, from=android.view.InsetsSourceConsumer.show:229 android.view.InsetsController.showDirectly:1437 android.view.InsetsController.controlAnimationUnchecked:1110 android.view.InsetsController.applyAnimation:1417 android.view.InsetsController.show:962 android.view.ViewRootImpl$ViewRootHandler.handleMessage:6146 android.os.Handler.dispatchMessage:106 android.os.Looper.loop:246 android.app.ActivityThread.main:8595 java.lang.reflect.Method.invoke:-2 I/ViewRootImpl@ea15fdfMainActivity: MSG_RESIZED_REPORT: frame=(0,0,1080,2400) ci=(0,80,0,944) vi=(0,80,0,944) or=1 I/ViewRootImpl@ea15fdfMainActivity: [DP] dp(1) 1 android.view.ViewRootImpl.reportNextDraw:10957 android.view.ViewRootImpl.access$1200:256 android.view.ViewRootImpl$ViewRootHandler.handleMessage:6101 I/SurfaceControl(12701): nativeRelease nativeObject s[-5476376677826290144] I/SurfaceControl(12701): nativeRelease nativeObject e[-5476376677826290144] I/SurfaceControl(12701): assignNativeObject: nativeObject = 0 Surface(name=null)/@0x167b48a / android.view.SurfaceControl.readFromParcel:1117 android.view.IWindowSession$Stub$Proxy.relayout:1820 android.view.ViewRootImpl.relayoutWindow:9005 android.view.ViewRootImpl.performTraversals:3360 android.view.ViewRootImpl.doTraversal:2618 android.view.ViewRootImpl$TraversalRunnable.run:9971 android.view.Choreographer$CallbackRecord.run:1010 android.view.Choreographer.doCallbacks:809 android.view.Choreographer.doFrame:744 android.view.Choreographer$FrameDisplayEventReceiver.run:995 I/SurfaceControl(12701): nativeRelease nativeObject s[-5476376677826253632] I/SurfaceControl(12701): nativeRelease nativeObject e[-5476376677826253632] I/SurfaceControl(12701): nativeRelease nativeObject s[-5476376677826290032] I/SurfaceControl(12701): nativeRelease nativeObject e[-5476376677826290032] I/SurfaceControl(12701): nativeRelease nativeObject s[-5476376677826249488] I/SurfaceControl(12701): nativeRelease nativeObject e[-5476376677826249488] I/ViewRootImpl@ea15fdfMainActivity: Relayout returned: old=(0,0,1080,2400) new=(0,0,1080,2400) req=(1080,2400)0 dur=16 res=0x1 s={true -5476376672993932736} ch=false fn=37 I/ViewRootImpl@ea15fdfMainActivity: [DP] pd() Asnyc report W/libEGL (12701): EGLNativeWindowType 0xb400006e55f60a50 disconnect failed I/ViewRootImpl@ea15fdfMainActivity: [DP] pdf(0) 1 android.view.ViewRootImpl.lambda$performDraw$1$ViewRootImpl:4668 android.view.-$$Lambda$ViewRootImpl$DJd0VUYJgsebcnSohO6h8zc_ONI.run:6 android.os.Handler.handleCallback:938 I/ViewRootImpl@ea15fdfMainActivity: [DP] rdf() I/SurfaceControl(12701): nativeRelease nativeObject s[-5476376677826287232] I/SurfaceControl(12701): nativeRelease nativeObject e[-5476376677826287232] D/InputMethodManager(12701): SSI - flag : 0 Pid : 12701 view : com.example.flutter_mqtt D/InputMethodManager(12701): view is not EditText D/InputMethodManager(12701): prepareNavigationBarInfo() DecorView@b50f53d[MainActivity] D/InputMethodManager(12701): getNavigationBarColor() -855310 D/InputMethodManager(12701): SSI - flag : 0 Pid : 12701 view : com.example.flutter_mqtt D/InputMethodManager(12701): view is not EditText D/InputMethodManager(12701): prepareNavigationBarInfo() DecorView@b50f53d[MainActivity] D/InputMethodManager(12701): getNavigationBarColor() -855310 D/InputMethodManager(12701): SSI - flag : 0 Pid : 12701 view : com.example.flutter_mqtt D/InputMethodManager(12701): view is not EditText D/InputMethodManager(12701): prepareNavigationBarInfo() DecorView@b50f53d[MainActivity] D/InputMethodManager(12701): getNavigationBarColor() -855310 D/InputMethodManager(12701): SSI - flag : 0 Pid : 12701 view : com.example.flutter_mqtt D/InputMethodManager(12701): view is not EditText D/InputMethodManager(12701): prepareNavigationBarInfo() DecorView@b50f53d[MainActivity] D/InputMethodManager(12701): getNavigationBarColor() -855310 D/InputMethodManager(12701): SSI - flag : 0 Pid : 12701 view : com.example.flutter_mqtt D/InputMethodManager(12701): view is not EditText D/InputMethodManager(12701): prepareNavigationBarInfo() DecorView@b50f53d[MainActivity] D/InputMethodManager(12701): getNavigationBarColor() -855310 I/ViewRootImpl@ea15fdfMainActivity: ViewPostIme pointer 0 I/ViewRootImpl@ea15fdfMainActivity: ViewPostIme pointer 1 I/ViewRootImpl@ea15fdfMainActivity: ViewPostIme pointer 0 I/ViewRootImpl@ea15fdfMainActivity: ViewPostIme pointer 1 D/InputMethodManager(12701): SSI - flag : 0 Pid : 12701 view : com.example.flutter_mqtt D/InputMethodManager(12701): view is not EditText D/InputMethodManager(12701): prepareNavigationBarInfo() DecorView@b50f53d[MainActivity] D/InputMethodManager(12701): getNavigationBarColor() -855310 D/InputMethodManager(12701): prepareNavigationBarInfo() DecorView@b50f53d[MainActivity] D/InputMethodManager(12701): getNavigationBarColor() -855310 V/InputMethodManager(12701): Starting input: tba=com.example.flutter_mqtt ic=io.flutter.plugin.editing.InputConnectionAdaptor@2dad660 mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false D/InputMethodManager(12701): startInputInner - Id : 0 I/InputMethodManager(12701): startInputInner - mService.startInputOrWindowGainedFocus D/InputTransport(12701): Input channel constructed: 'ClientS', fd=111 D/InputTransport(12701): Input channel destroyed: 'ClientS', fd=115 W/IInputConnectionWrapper(12701): getExtractedText on inactive InputConnection W/IInputConnectionWrapper(12701): getTextBeforeCursor on inactive InputConnection D/InputMethodManager(12701): SSI - flag : 0 Pid : 12701 view : com.example.flutter_mqtt D/InputMethodManager(12701): view is not EditText D/InputMethodManager(12701): prepareNavigationBarInfo() DecorView@b50f53d[MainActivity] D/InputMethodManager(12701): getNavigationBarColor() -855310 D/InputMethodManager(12701): SSI - flag : 0 Pid : 12701 view : com.example.flutter_mqtt D/InputMethodManager(12701): view is not EditText D/InputMethodManager(12701): prepareNavigationBarInfo() DecorView@b50f53d[MainActivity] D/InputMethodManager(12701): getNavigationBarColor() -855310 D/InputMethodManager(12701): SSI - flag : 0 Pid : 12701 view : com.example.flutter_mqtt D/InputMethodManager(12701): view is not EditText D/InputMethodManager(12701): prepareNavigationBarInfo() DecorView@b50f53d[MainActivity] D/InputMethodManager(12701): getNavigationBarColor() -855310 D/InputMethodManager(12701): SSI - flag : 0 Pid : 12701 view : com.example.flutter_mqtt D/InputMethodManager(12701): view is not EditText D/InputMethodManager(12701): prepareNavigationBarInfo() DecorView@b50f53d[MainActivity] D/InputMethodManager(12701): getNavigationBarColor() -855310 D/InputMethodManager(12701): SSI - flag : 0 Pid : 12701 view : com.example.flutter_mqtt D/InputMethodManager(12701): view is not EditText D/InputMethodManager(12701): prepareNavigationBarInfo() DecorView@b50f53d[MainActivity] D/InputMethodManager(12701): getNavigationBarColor() -855310 I/ViewRootImpl@ea15fdfMainActivity: ViewPostIme pointer 0 I/ViewRootImpl@ea15fdfMainActivity: ViewPostIme pointer 1 I/flutter (12701): 1-2021-09-23 13:29:13.403568 -- MqttClient::connect - keep alive is enabled with a value of 60 seconds I/flutter (12701): 1-2021-09-23 13:29:13.407537 -- MqttConnectionKeepAlive:: Initialised with a keep alive value of 60 seconds I/flutter (12701): 1-2021-09-23 13:29:13.407654 -- MqttConnectionKeepAlive:: Disconnect on no ping response is disabled I/flutter (12701): 1-2021-09-23 13:29:13.409169 -- MqttConnectionHandlerBase::connect - server 172.16.14.99, port 1883 I/flutter (12701): 1-2021-09-23 13:29:13.411321 -- SynchronousMqttServerConnectionHandler::internalConnect entered I/flutter (12701): 1-2021-09-23 13:29:13.411491 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress false I/flutter (12701): 1-2021-09-23 13:29:13.411738 -- SynchronousMqttServerConnectionHandler::internalConnect - insecure TCP selected I/flutter (12701): 1-2021-09-23 13:29:13.412121 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connect I/flutter (12701): 1-2021-09-23 13:29:13.412846 -- MqttNormalConnection::connect - entered`

Also I couldn't find the documentation, so I added the dependency into the same directory as this repository and apparently I can run the application, but in order to login, I must register, right?

WahidNasri commented 3 years ago

Hello, Thank you for your interest. Currently registering new users is not supported by the Flutter MQTT Chat client, you can build a simple Crud app for that. To be able to run the example app, you can insert some records into the user table.

Also, I see you're running the app on an Android device (S21), it is preferable that you specify the IP address of the machine running the broker, not 127.0.0.1 or localhost event it is an emulator on the same machine.

staminna commented 3 years ago

Thanks for input.

I almost don't have any knowledge of MQTT, but can a broker be a mobile phone?

WahidNasri commented 3 years ago

The broker is simply MQTT server. For our case, I am using HiveMQ as a server with a custom extension that I built.

So you have to install HiveMq on a machine, connect it to a database and then use the mobile app that should refer to that machine :) Think of it like Facebook messenger or Whatsapp, it should be a server there orchestrating the rules and the messages between the users. Glad to help you.