1

I am trying to create a simple application in GJS that sends desktop notifications based on json received via WebSocket. What is the easiest way to use WebSocket in GJS? Thanks in advance.

nexryai
  • 33
  • 1
  • 3

2 Answers2

3

I wrote an example here https://gitlab.gnome.org/GNOME/gjs/-/blob/master/examples/websocket-client.js

If you would like to use a similar API to browsers, have a look at https://github.com/sonnyp/troll

Sonny Piers
  • 365
  • 3
  • 4
2

In GJS you'll probably have to use libsoup for this.

The GJS documentation is at https://gjs-docs.gnome.org/soup30, such as the Soup.WebSocketConnection.

You'll probably also want to read the upstream documentation which includes some introductory material.

andy.holmes
  • 3,383
  • 17
  • 28