Closed yarreg closed 1 year ago
Can you check if the last commit will work for you?
I exposed writeFrame
, and also added writePing
and writePong
.
I also added handle_ping
, handle_pong
and handle_close
configuration options, all defaulting to false
. When true
however, the corresponding message will be sent to the handle
method of the handler. It'll be up to the handler to check the message.type
and process it accordingly. This also disables the automatic handling of both close
and ping
(though in the case of close, the readLoop will still terminate).
Thanks!
Firstly, thank you for your hard work on this library. I have been using it for a project and it's been really helpful.
I recently had a requirement where I needed to send a ping frame from the WebSocket client to check the connection status. However, I found that the
Client.writeFrame
method, which could be potentially used for this purpose, is not publicly accessible.Proposal: I believe this is a feature that could be valuable for various use-cases, and I'd like to propose one of the following solutions:
Make the
Client.writeFrame
method public: By doing this, users of the library can have the flexibility to write any type of frame as per their needs. Add pong to handler.Introduce a dedicated
.ping
method for the Client: This would allow users to easily send a ping frame without having to deal with the frame internals. Additionally, for this method, an extended handler could be provided to handle the pong response or any related events.