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

feature: add an option to send bytes with ws #1828

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

Conversation

YoniGang
Copy link

@YoniGang YoniGang commented Feb 18, 2023

Add an option to send bytes through web sockets.
Including an example of a function that sends stream and example of how to send bytes with a string without a function

Issue ref: #1780

@YoniGang YoniGang changed the title Add an option to send bytes with ws #1780 feature: add an option to send bytes with ws #1780 Feb 18, 2023
@YoniGang YoniGang changed the title feature: add an option to send bytes with ws #1780 feature: add an option to send bytes with ws Feb 18, 2023
@YoniGang
Copy link
Author

I uploaded it without automatic tests. Just tested it myself. We use it in my work to test out web sockets. I would be glad to get some help with tests.

@CLAassistant
Copy link

CLAassistant commented Feb 18, 2023

CLA assistant check
All committers have signed the CLA.


const get_bytes_payload = (payload) => {
if (typeof payload === 'string') {
let utf8Encode = new TextEncoder()
Copy link
Member

Choose a reason for hiding this comment

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

Is there a particular reason to use TextEncoder here? is that a common way to encode binary data for WebSockets?

Copy link
Author

@YoniGang YoniGang Feb 23, 2023

Choose a reason for hiding this comment

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

Actually not. It was just a way that I found to turn string into bytes with js. I wanted that there will be an option to send string as bytes as well.

@hassy
Copy link
Member

hassy commented Feb 23, 2023

thank you @YoniGang! adding a test should be fairly straightforward, I'll try to put a quick one together today that we can iterate on if needed.

@YoniGang
Copy link
Author

YoniGang commented Mar 9, 2023

Hii @hassy! Oo you have any update?

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.

None yet

3 participants