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

Adding binary transfer option for websockets #37

Open
j-nik opened this issue May 10, 2024 · 1 comment
Open

Adding binary transfer option for websockets #37

j-nik opened this issue May 10, 2024 · 1 comment

Comments

@j-nik
Copy link

j-nik commented May 10, 2024

In AsyncFsWebServer.h you have the following to allow a websocket broadcast of a text message:

/*
 * Broadcast a websocket message to all clients connected
*/
void wsBroadcast(const char * buffer) {
  m_ws->textAll(buffer);
}

I've added the following below this to allow broadcasts of an array of bytes, which I find quite useful:

/*
 * Broadcast a binary websocket message to all clients connected
*/
void wsBroadcastBinary(uint8_t * message, size_t len) {
  m_ws->binaryAll(message, len);
}
@j-nik
Copy link
Author

j-nik commented May 11, 2024

If you do so augment your library, I've written an example you could consider adding.

https://forum.arduino.cc/t/binary-data-over-websockets-with-the-asyncespfswebserver-library/1258142/3

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

No branches or pull requests

1 participant