lorenzodonini / ocpp-go

Open Charge Point Protocol implementation in Go
MIT License
262 stars 125 forks source link

Auto-reconnection support in websockets #49

Closed lorenzodonini closed 3 years ago

lorenzodonini commented 3 years ago

Implements auto-reconnect behavior for client websockets, as requested in https://github.com/lorenzodonini/ocpp-go/issues/38.

Implementation details

Known Issues

This new feature only affects the websocket package and is not yet fully integrated by the ocpp-j package.

The OCPP library will work as before, but upon reconnection, no retransmissions are triggered and no pending requests are cancelled. This will be tackled in a future PR.

Connection tests

Tests for network errors were added, to simulate connection drops.

Toxiproxy is being used as a service for this purpose.

lorenzodonini commented 3 years ago

@andig feel free to have a look at this, if you want.

I'll be working on integrating this properly with the ocpp-j layer and add some further improvements on a separate branch.

andig commented 3 years ago

feel free to have a look at this, if you want.

I just glanced over it but didn't try. From the comments you can see that I did not entirely grasp how you've designed this to work, please feel free to ignore the comments if not relevant.

lorenzodonini commented 3 years ago

feel free to have a look at this, if you want.

I just glanced over it but didn't try. From the comments you can see that I did not entirely grasp how you've designed this to work, please feel free to ignore the comments if not relevant.

Feedback is always appreciated :) Pushed some changes already. If something is still unclear, let me know