How to send text/data via websockets(soup_websocket_connection_send_text) within the libsoup library using GJS ?



Hi,


My apologies to all, if this is in the wrong group.


I have been working on a gnome shell extension that utilizes websockets to communicate with the parent application and have resorted to using python to communicate via websockets in the previous versions. This is causing dependency issues and the only way I can solve this is by utilizing libsoup library implementation of websockets within the extension. I have not been able to find any documentation in regards to utilizing websockets in GJS and for a while now have been wondering around not reaching any solution. I am hoping to reach out to you for your help.  The only code I have come across implemented within GJS utilizing libsoup and websockets is the following:


    let session = new Soup.Session();
    Soup.Session.prototype.add_feature.call(session, new Soup.ProxyResolverDefault())
    session.httpAliases = ["ws"];
        
    let logger = Soup.Logger.new(Soup.LoggerLogLevel.BODY, -1);
    logger.attach(session);
    logger.set_printer(function(logger, level, direction, data) { print(data); });

    let message = new Soup.Message({
    method: "GET",
    uri: new Soup.URI('ws://localhost:8000/events')
     });

    session.websocket_connect_async(message, null, null, null, callback);
    session.websocket_connect_finish(res);

The above allows me to create a connection to my application with a request header and response callback but I am unable to find any reference to "soup_websocket_connection_send_text" method implementation in GJS which allows me to send string/text data along with my GET request. 

Request you to please help me with the above.

Regards,
Aditya Mehra



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]