usocket implementation to detect when a client disconnects #13423
Unanswered
Hruthik0x
asked this question in
Libraries & Drivers
Replies: 4 comments 3 replies
-
Hi |
Beta Was this translation helpful? Give feedback.
0 replies
-
But for this, I have to keep emitting text for every timeout seconds right ?
Isn't that polling ?
…On Sun, 14 Jan, 2024, 2:40 pm sophiedegran, ***@***.***> wrote:
Hi
Did you look at
github.com/peterhinch/micropython-async/blob/master/v3/as_driver/client_server
?
For me the timeout is good.. you can decrease it..
Hope that help
—
Reply to this email directly, view it on GitHub
<#13423 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQTUTIPW7VFAA7EXGS6JAT3YOOOJTAVCNFSM6AAAAABBZSTVVWVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DCMRSGU3DM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
In my case, I just want the server to know when a user connects and
disconnects from the server.
Socketio, Flask_socketio have something like
@socket.on("connect") and @socket.on ("disconnect") to detect when a client
connects and disconnects, they also provide the sid, by using request.sid
(unique to each client, could be used to identify each client and send
message specific to a client)
I am looking for something like that in micropython.
…On Sun, 14 Jan, 2024, 3:16 pm sophiedegran, ***@***.***> wrote:
I don't know what your expect to do with opening socket.. In this example
userver wait for an exchange by uclient and if the timeout exceeded userver
close the socket connexion..
Perharps it's your client that have been to run userver?
—
Reply to this email directly, view it on GitHub
<#13423 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQTUTIJEHERCOBKXRL3G6S3YOOSOHAVCNFSM6AAAAABBZSTVVWVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DCMRSG4YTO>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Thank you.
I'm planning to contribute to micropython, please tell me where to start (I
am new to micropython, so I want to know how to write code to contribute,
like build a new library etc.)
…On Sun, 14 Jan 2024 at 18:27, sophiedegran ***@***.***> wrote:
Yes ok it's like websocket..
You will find them under microdot (it's framework web) under micropython
as a 'small' flask
but there's not directly this function to know if connect/ disconnect...
Have a look to microdot it's an amazing web server !
—
Reply to this email directly, view it on GitHub
<#13423 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQTUTINJYSYXT4AMR2YPBQ3YOPIZ5AVCNFSM6AAAAABBZSTVVWVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DCMRTGU4TA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Someone please show me an implementation of micropython code to setup a socket server that can handle multiple clients simultaneously and can detect when a client connects, disconnects.
There should be a mechanism, to detect which client disconnected.
Beta Was this translation helpful? Give feedback.
All reactions