-
Notifications
You must be signed in to change notification settings - Fork 164
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
Bug in void mocpp_initialize(const char *backendUrl,... #278
Comments
Hi @samuellavoie90, thanks for this report! Did you already try to change the url parameter of webSocket->begin() accordingly? Did it work? |
Yes, I already did the change: I added a new string called 'Path' under Host_Port_Path, and I concatenated the chargerID to it instead of Url. It worked well, but we only tried the non encrypted socket->begin. Before making the change, I also looked at pretty much the entire code path of socket->begin and it really does expect only the path component of the URL (first '/' included). I suspect the error was introduced when the signature for the mocpp_initialize was changed. |
Thanks for taking a deeper look, will fix it like suggested. Actually this confused me for years. It is possible to send the full URL in HTTP requests, but it's really uncommon and quite a few WS servers had issues with it. I thought the WS lib had a weird behavior there, but it turns out it was just me 😅 |
@samuellavoie90 The fix is ready now: #283 Can you check if it works with your WS server? |
* use WS path instead of URL (#278) * update arduinoWebSockets integration
In mocpp_initialize(const char *backendUrl,... a websocket is initialized:
webSocket->begin(host.c_str(), port, url.c_str(), "ocpp1.6");
The entire url (ws://Server.local:8500/ocpp/ChargerId) is passed to this websocket, when this library (arduinoWebSockets) was actually expecting only to have the path (/ocpp/ChargerId) passed there, this results in a badly formed HTTP packet for the initial websocket creation handshake.
In the screenshot you can sort of see the intended use is for URL to only have the Path component, since the default value is '/'
The text was updated successfully, but these errors were encountered: