Code Monkey home page Code Monkey logo

Comments (12)

luohao123 avatar luohao123 commented on August 30, 2024

SocketException: Connection reset by peer (OS Error: Connection reset by peer, errno = 104)

how to use WebSocket mode

from mqtt_client.

shamblett avatar shamblett commented on August 30, 2024

Socket exceptions are raised by the Dart runtime not the client. What happens on ypur platform when the network cable is pulled has nothing to do with the client code. The client just picks up the exception and propagates it

May well work in the browser, this is a different runtimr again and websockets are not server side sockets

from mqtt_client.

luohao123 avatar luohao123 commented on August 30, 2024

Got this error just after server report duplicated id login error.

from mqtt_client.

shamblett avatar shamblett commented on August 30, 2024

Ok sounds like the broker has closed the connection which should be signalled to the client as an onDone event, it seems this is not happening. Ill need a client log to go any further.

Note that Ive never heard of an MQTT broker refusing a connection because the client id is one that has been used before it may do this if you already have a connection active with the same client id.

from mqtt_client.

luohao123 avatar luohao123 commented on August 30, 2024

@shamblett thank u sir, this the golang broker I use: DrmagicE/gmqtt#203

here is the thing i found for now:

Seems the server got duplicated client_id when I connected, and then, the server will close the old client_id, but somehow, it takes the old client_id as current, so once I just connected, the server just disconnected due to treat this client_id as old one.

Is this could happen? (the link I attached is Chinese, using translate could possibly knows what it means)

from mqtt_client.

shamblett avatar shamblett commented on August 30, 2024

This seems wrong, if when you connected the broker still had an active connection with the same client id, you should disconnect this before trying to connect again. If you have done this then the broker should have closed the connection to that client so when you connect again there is only 1 connection. If the broker at anytime wants to disconnect you or the network fails when you connect again there should be no old client connections with the same id hanging around. If your broker is doing this then its wrong.

from mqtt_client.

luohao123 avatar luohao123 commented on August 30, 2024

Am not sure whether is broker issue or not, but I changed another broker, same situation found.

Once the client connected, then disconnected imediately. Do u know how could this happen?

from mqtt_client.

shamblett avatar shamblett commented on August 30, 2024

There are many reasons, the only way to tell is to look at your broker logs, the client can't help you anymore.

from mqtt_client.

luohao123 avatar luohao123 commented on August 30, 2024

Hi, I using test.mosquitto.org, same error got.

from mqtt_client.

shamblett avatar shamblett commented on August 30, 2024

You still ned to look at your broker logs no matter what broker you are using.

from mqtt_client.

luohao123 avatar luohao123 commented on August 30, 2024

I don't think test.mosquittto.org provides such a log. Is there anything could be possible reason on client?

I look into the mqttclient example code, none of them really work on a real flutter app.

Although it could be same, but in flutter it has more complicated lifecycle, a good mqtt workable example would be very good for users to start with.

from mqtt_client.

shamblett avatar shamblett commented on August 30, 2024

It doesnt, it is just a test to see if the behaviour remains the same. Either way whichever brolker you use only its logs can tell you whats happening.

from mqtt_client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.