github Azure/azure-sdk-for-js @azure/web-pubsub-express_1.0.0-beta.3

latest releases: @azure/cosmos_4.2.0-beta.1, @azure/arm-hybridcompute_4.1.0-beta.1, @azure-rest/ai-translation-document_1.0.0...
pre-release3 years ago

1.0.0-beta.3 (2021-07-30)

  • Support reading and setting connection states, sample usage:
    const handler = new WebPubSubEventHandler("chat", ["https://xxx.webpubsub.azure.com"], {
      handleConnect(req, res) {
        // You can set the state for the connection, it lasts throughout the lifetime of the connection
        res.setState("calledTime", 1);
        res.success();
      },
      handleUserEvent(req, res) {
        var calledTime = req.context.states.calledTime++;
        console.log(calledTime);
        // You can also set the state here
        res.setState("calledTime", calledTime);
        res.success();
      }
    });

Don't miss a new azure-sdk-for-js release

NewReleases is sending notifications on new releases.