Skip to content
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

New package: libwebsockets #213

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ConnorRigby
Copy link

This adds support for libwebsockets
the port is pretty simple, mostly the same as the freertos platform used by esp32

-DLWS_PLAT_NX=ON \
-DLWS_WITH_UDP=OFF \
-DLWS_WITH_FILE_OPS=OFF \
-DCMAKE_BUILD_TYPE=DEBUG \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want -DCMAKE_BUILD_TYPE=RELEASE here I think.

+#include <arpa/inet.h>
+#include <fcntl.h>
+#include <switch/kernel/mutex.h>
+#include <switch/services/bsd.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use this bsd header. We translate between newlib fds & horizon fds internally. Use standard <sys/socket.h>

+#define compatible_close(x) close(x)
+#define lws_plat_socket_offset() 0
+#define wsi_from_fd(A,B) A->lws_lookup[B - lws_plat_socket_offset()]
+#define shutdown(sockfd, how) bsdShutdown(sockfd, how)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shutdown is found in <sys/socket.h> don't use the bsd functions directly.

@ConnorRigby
Copy link
Author

Thanks for the review @WinterMute!
I just moved so it might take me a few more days to get to this, but i'll certainly get too it this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants