weechat / weechat

The extensible chat client.

Home Page:https://weechat.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support establishing a WebSocket connection from plugins/scripts

trygveaa opened this issue · comments

Feature description

It would be useful to have an API function which establishes a WebSocket connection and allows you to send and receive data over it. So it would take a URL to connect to, probably a timeout value, the proxy to use (or use the proxy defined by weechat.network.proxy_curl). For my use case I would also need to specify the cookies sent. Being able to specify any header, rather than just cookies could be useful too.

The callback for receiving data and the function for sending data should handle TLS and compression (if used) transparently. There should also be a way to close the connection, and there should be a callback for when the connection is lost or closed from the server side.

Maybe it should also be possible to specify how often pings should be sent or a way to send ping manually. Answering to pings from the server should be handled transparently I think.