-
Notifications
You must be signed in to change notification settings - Fork 109
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
Check if the ocppj client is connected? #154
Comments
In my mind, disconnection/reconnection are events that you wish to be notified by, so you don't have to actively poll. |
Yes, exactly, I'd prefer a top level function to check the connection. Looking at internal objects seems a bit "unsafe" to me. The state is not to be polled constantly, but some charger behaviour will be different when offline, so I need to keep track of the connection status. |
I added the suggested accessor method. Feel free to have a look. |
By adding handlers for disconnect and reconnect I can find out and store whether or not the client is connected to the server, but wouldn't it be easier if I could ask the client for that information?
If I create the wsClient and give it to the client at creation, I can keep it and check that with wsClient.IsConnected(), but that breaks the encapsulation in an ugly way, IMO.
Is there another way to do it, or wouldn't it be nice to have a IsConnected()-function on the client (just sending the question on to endpoint/wsClient)?
The text was updated successfully, but these errors were encountered: