You can use any existing Lua API functions to access the collections that the controller provides.
But, there is no such Lua call that provides a rooms list for now.
We can add it in case something is needed and that something isn’t violating security rules.
The way of obtaining something in a Lua plugin that is a part of WebSocket API is not the right way, I think.
It needs your code to support both secure and insecure ways of communication, for a secure one you need to update user credentials, etc.
To your question: there is no way to establish a WebSocket connection from a hub to an outer WebSocket server.
There is no such functionality, and it cannot be implemented without firmware support.
What we provide is a HTTP lua module to which make it possible to make queries outside of a hub in an asynchronous way.
There is no way to write and execute synchronous lua code on a hub.
So, to solve your task, I’d suggest you to make an HTTP connection from your “server” to the E450’s HTTP server .
Like, you can subscribe to all the broadcasts of a hub using this one: https://IP:17000/v1/broadcasts.
It will give you an SSE (Server-Side Events) stream of changes.
And, another one: /v1/request, will give you the ability to ask WebSocket API requests directly from the hub.