lorenzodonini / ocpp-go

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

Add option to server to get TLS ConnectionState for connections #69

Closed michaelbeaumont closed 3 years ago

michaelbeaumont commented 3 years ago

This is one way of doing it, another would be to stash the tls.ConnectionState in the WebSocket and add an accessor.

lorenzodonini commented 3 years ago

I honestly like the second idea better, because it allows to access everything in the same callback. The information can easily be passed all the way to the application. It would be a breaking change in the interface though, so up for debate. Btw I'm currently working on some improvements in the websocket package, so I could add your suggestion there directly in that case.

michaelbeaumont commented 3 years ago

So to be clear, adding it to ws.Channel? I actually like that option better as well.

lorenzodonini commented 3 years ago

So to be clear, adding it to ws.Channel? I actually like that option better as well.

Yes, that's right

lorenzodonini commented 3 years ago

Changes look good. The TLS field is not exposed yet to the callback in the ocpp1.6/2.0 package (only the client ID is being passed there). I can take care of it in a follow-up PR, if you want.

michaelbeaumont commented 3 years ago

Good point! I can do the PR now, I'll pass the ws.Channel to all the Server handlers.

lorenzodonini commented 3 years ago

Good point! I can do the PR now, I'll pass the ws.Channel to all the Server handlers.

I merged this PR in the meantime. It's gonna be quite a few changes, since you'll need to change the callback's signature, so I thought it would be best to keep it separate.