-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
Websockets no async #319
Websockets no async #319
Conversation
Nice @MarkusSchneider ! I see your updates to that branch. I'm going to ride test it ASAP and see if we're stable. Looks awesome! Do you have a preference on what port we should use for the websocket? Is there a standard? For now, I'll update the status.html to use port 8080 that you selected |
Don't know if there is a standard port. If you have a web server who is able to talk http and ws default is 80 or 443. But Port 80 is already used by http_server and http_server is not able to talk ws. Let's go with port 8080 😉 |
Hi @doudar I've added the mutex. Work is almost done. We can remove the HTTP-Log Buffer if no longer need and cleanup status.html (remove udp-logger hint, request debugLog, slice log messages, ...) |
Looking good! |
I've removed DebugInfo. I've also remove some macros and extended writev function to get level and module to be prepared for filtering in the future. Lines 50 to 77 in 3dcbe2b
|
I'm busy with other work today but I like what you've done. I'll be troubleshooting the BLE disconnect when I get time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need to fix the status.html to work with websockets. It’s close but I didn’t finish it yet. I’m having trouble getting it to only connect to the websocket when udpLogging is disabled.
I don't think that websockets must disabled when UPD logging is enabled. All is running now inside the main-task. With websocket every message is only sent once. In the previous implementation the message buffer was sent ever second. I'll rework status.html and we can test if performance is good. |
…gLog from HTTP-Server
I've updated status.html. Lines 135 to 145 in 8b924bc
in line 140. I've limited the log to 1000 lines. |
Thanks!!!! |
@doudar finished my tests. Fixed a re-connection problem. All is now running stable. Also did a test ride and BLE works great. I'm using a std::vector to handle the registered appenders: Line 78 in 683833a
it's maybe better to use an array to avoid head defragmentation, but appenders only added once so it should not be a problem. |
Hi Anthony,
I've added the first implementation of the new logger concept.
I've used the FreeRTOS MessageBuffer instead of the Queue. Queues allow only fixed size data structures. MessageBuffers are build for variable sized strings.
I moved away from https://github.com/Links2004/arduinoWebSockets library, I think the library is no longer maintained (162 open issues 😒) and picked https://github.com/gilmaimon/ArduinoWebsockets.
Please take a look at the implementation.
Two things are open:
SmartSpin2k/src/SS2KLog.cpp
Lines 44 to 58 in 4152504
I've disable the buffer for http logging. If we need them in future, I can build a BufferedAppender and http_server can read the content of the buffer from the appender, no need to have this inside SSKLog.
For testing I've used a chrome extension:
https://chrome.google.com/webstore/detail/simple-websocket-client/pfdhoblngboilpfeibdedpjgfnlcodoo?hl=de