Skip to content

v3.9.1

Compare
Choose a tag to compare
@kgardnr kgardnr released this 20 Dec 23:22
e2cb3fd

Fixes & Dev Support

  • Deprecate body-parser in favor of express.json()

  • Previously, we parsed the expiry date using the ms package, yet the services consuming this value assumed seconds; we've adjusted those services to ensure that while the input is parsed from ms, we convert to seconds before using

  • Add support for plugin hooks on the websocket connections to support a plugin like the following:

    const ms = require('ms');
    const clients = new Map();
    
    module.exports = {
      websockets: {
        onConnect: async (params, websocket) => {
          clients.set(websocket, {subscribed: Date.now()});
          console.log(`${clients.size} clients - new client connected`);
        },
        onDisconnect: async (websocket) => {
          if (clients.has(websocket)) {
            const client = clients.get(websocket);
            clients.delete(websocket);
            console.log(`${clients.size} clients - client disconnected after ${ms(Date.now() - client.subscribed)}`);
          }
        },
      },
    };