curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Send data before receiving data using the callback approach for WebSocket requests

From: Daniel Stenberg via curl-library <curl-library_at_lists.haxx.se>
Date: Wed, 7 Jun 2023 08:17:15 +0200 (CEST)

On Mon, 5 Jun 2023, Darshan Sen via curl-library wrote:

> Actually, I would still need this to work with the callback approach
> because my application is required to work in a push-based mechanism, so
> that it can allow users to attach callbacks to listen for received data
> instead of a pull-based model where users would need to explicitly call my
> APIs to pull in the received data. To be clear, I'm basically creating a
> libcurl-based Node.js C++ addon <https://nodejs.org/api/addons.html> for
> the WebSocket JavaScript Web API
> <https://developer.mozilla.org/en-US/docs/Web/API/WebSocket> where users
> should be able to attach callback handlers to process the received data and
> explicitly call my APIs to send data.

Right now, the callback approach only sends incoming data to the write
callback so there is no way to first send data or to use the read callback.

I'm open for discussing how we can improve this so maybe we can come up with a
way for this that can be made to work in a future?

-- 
  / daniel.haxx.se
  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features
  | https://curl.se/support.html
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2023-06-07