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: Dmitry Karpov via curl-library <curl-library_at_lists.haxx.se>
Date: Mon, 19 Jun 2023 22:15:52 +0000

The "open" callback covers a bunch of use cases when WS client needs to send something immediately after opening a WebSocket.
So, when this callback is called, the WebSocket should be opened successfully and fully operational, so it can send WS messages.

Practical use cases depend on WS applications, and their proprietary WS-message based communication protocols.
One example that I know is some WS client app communicating to a remote WS application controlling a web camera.
After opening a WebSocket, it sends some command requesting to send back a camera status.

A good test use case to test this callback is to open a WebSocket on some public "echo" WS server (which "echoes" back a WS message it receives),
send some WS message (text or binary) in the "open" callback and verify that our WS client receives the same message back.

Thanks,
Dmitry Karpov

-----Original Message-----
From: Daniel Stenberg <daniel_at_haxx.se>
Sent: Sunday, June 18, 2023 2:47 PM
To: Dmitry Karpov via curl-library <curl-library_at_lists.haxx.se>
Cc: Dmitry Karpov <dkarpov_at_roku.com>
Subject: [EXTERNAL] Re: Send data before receiving data using the callback approach for WebSocket requests

On Wed, 7 Jun 2023, Dmitry Karpov via curl-library wrote:

> I think there should be WS_OPEN callback, called when WebSocket has
> been successfully opened, which would allow to send data right after opening.

I'm open for discussing/implementing this. Ideally if someone has a use case that needs this feature that we can work with to make sure it works fine.

-- 
  / 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-20