Skip to content

about the websocket in libdatachannal #1088

Answered by paullouisageneau
bestxpp asked this question in Q&A
Discussion options

You must be logged in to vote

The method send(message_variant data) does not copy binary data (the library uses move semantics where possible), but send(const byte *data, size_t size) does copy the data. The library will attempt to send synchronously: if the data can be sent synchronously, send() returns true, but if it's not possible because the underlying socket buffer is full (meaning you are sending too fast), send() returns false, and the data is kept buffered and will be sent it asynchronously when possible. In any case, send() does not block on network. The method is also thread-safe, meaning you can send concurrently from different threads.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@bestxpp
Comment options

@paullouisageneau
Comment options

Answer selected by bestxpp
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants