Rdb2js Update

Version 2.3 is out.

There is one significant addition, the broadcast method.

var pr = req.listen('publik')
            .broadcast('publik', 'Hello World')

The above method would send the message 'Hello World' to all clients registered on the channel 'publik'. It would also have the effect of registering this client on the channel, if it is not already.

The version 2 library uses web-sockets to connect to the server, so the client (browser) holds a persistent connection to the server, and the server can send messages down the connection asynchronously. One client can thus communicate with other clients via the server.

The broadcast method is a shortcut for something like below:

var pr = req.listen('publik')
            .query("NOTIFY publik %s;")
            .params(['Hello World'])

A related change, is that the listen method will now accept a list of string channel-names as an alternative to a single name.

var pr = req.listen(['publik', 'usr123'])

Minor Changes

  • The popup dialogs that authorize white-listing and/or executing queries are now more detailed.
  • The queries embedded in the modules are now commented, so their functions should be clearer when read in the approval dialog.
  • The websocket library has been changed from reconnecting_websocket to robust_websocket. The latter library has a more thorough test suite. The RdbHost API is unchanged from the transition.

The JavaScript Module Docs
The module itself, 2.3

comments powered by Disqus