Web Socket Support

Hi there, just wanted to confirm if AG supports web sockets?

There’s a backend I’d like to create that exposes a real-time api via web sockets (using socket.io) so just checking if an AG app can use such a backend?


1 Like

WebSockets as a first-class citizen are something we are planning on as a dedicated feature, but not yet available.

I checked and self.WebSocket seems to be available in the JavaScript function logic node context (at least on web), so you could try using that to create a connection – let us know if you end up trying that and if you succeed/run into errors!


I’ve tested using self.Websocket successfully.

I’m using a websocket to connect to a graphql-ws endpoint and successfully subscribing to the updates pushed from Hasura GraphQL.

I’ll make this into a marketplace flow, but first I need to understand how to “trigger” a page/app variable update from my javascript without returning. E.g. is the page/app scope available to the javascript?

I tried returning after the data is received from the socket, but the 200ms caused errors when trying to output. I was able to use “alert(data)” right in the javascript to present to the page.

Any help on being able to engage triggers/variables from custom javascript would be greatly appreciated.



Could you please help Lance with his query? If he is successful in creating a flow function for this, it will be great help to every appgyver user. One of the primary use case for this is real time chat functionality which a lot of apps can benefit from.

I am planning to use backendless real time messaging feature that requires socket io library.


1 Like


This conversation was continued in this thread.

Hey @Ankit_Gupta, were you ever successful using Backendless to implement real time messaging?

Not really man. I gave up. The support since the SAP acquisition has also been very limited so not sure if there is a plan to support this.

1 Like

Well in theory according to Backendless all is needed is to build a custom client to their real-time endpoint using Websockets. It’s probably better to wait for third-party plugin support to use the Backendless JS SDK, unless it takes forever for these to be released :confused:

Hey @Harri_Sarsa, any chance we get websockets / socket.io support as first class citizen anytime soon? It is a bit jarring not to be able to build apps with real-time connections, as it is pretty much a given these days.

Wondering the same. Anything?

Have the same question.

No first-class support as of yet, and I’m afraid it has been pushed back in favor of other features.

self.WebSocket via JavaScript can still be used if coding is ok, and as discussed in the other thread linked above, it will require AppGyver admin magic to make setting page/app variables within JavaScript box work for you. But if you’re willing to do the coding, I checked what Harri had done to enable that page/app variable setting, so if you have a working example in a JavaScript box of your websocket stuff working, I can enable contextId and supersonic for you. Please see other thread for more info and please @ me with link to the page you have the javascript box on if you would like me to sprinkle that bit of magic.

1 Like

@Mevi Could you share a JavaScript example so that users can replicate without needing AG to help out every time?


Unfortunately this has nothing to do with having a JavaScript example or not – it has to do with not being able to access page/app variables within a JavaScript box, which is not a feature that is available and is unlikely to become available except upon request. Please check the thread linked above on how to proceed if you’re looking to implement this :slight_smile:

No worries - I figured out a way to achieve what I wanted. :slight_smile:

1 Like

I’ve been successfully using the supersonic “magic sprinkles” to implement a websocket client/dashboard in AG. I’m encountering a problem, however, with leaking open connections when the app reloads - I’m not able to tear down the connection before starting up again, so I create duplicate connections.

I’ve looked at adding the “Page will unmount” event to my canvas, with the intent to invoke a websocket teardown [ ws.close() ] in my javascript before the page reloads, but I’m not sure how to pipe that event into my javascript as the event doesn’t have an output (to receive into the js function) that I can see?

Any suggestions?

I’ve added the logic - the secret sauce is exposing the built-in supersonic and contextId properties (something regular users cannot do) and then using the supersonic.api.events.send function on the return of call. The Receive event node is below the JS box. Let me know if it works!

add to mine too