@bluecopa/core 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js
CHANGED
|
@@ -4817,14 +4817,13 @@ Centrifuge.SubscriptionState = SubscriptionState;
|
|
|
4817
4817
|
Centrifuge.State = State;
|
|
4818
4818
|
Centrifuge.UnauthorizedError = UnauthorizedError;
|
|
4819
4819
|
class CentrifugoWebsocket {
|
|
4820
|
-
constructor(connectionUrl) {
|
|
4820
|
+
constructor(connectionUrl, accessToken, userId) {
|
|
4821
4821
|
this.connectionUrl = connectionUrl;
|
|
4822
|
+
this.accessToken = accessToken;
|
|
4823
|
+
this.userId = userId;
|
|
4822
4824
|
this.centrifuge = null;
|
|
4823
4825
|
this.subscriptions = {};
|
|
4824
4826
|
this.isConnected = false;
|
|
4825
|
-
const config = getConfig();
|
|
4826
|
-
this.accessToken = config.accessToken;
|
|
4827
|
-
this.userId = config.userId;
|
|
4828
4827
|
}
|
|
4829
4828
|
connect() {
|
|
4830
4829
|
if (!this.accessToken) {
|
|
@@ -4844,10 +4843,7 @@ class CentrifugoWebsocket {
|
|
|
4844
4843
|
}
|
|
4845
4844
|
);
|
|
4846
4845
|
this.centrifuge.on("connecting", () => {
|
|
4847
|
-
console.log(
|
|
4848
|
-
"Connecting to centrifuge",
|
|
4849
|
-
this.connectionUrl
|
|
4850
|
-
);
|
|
4846
|
+
console.log("Connecting to centrifuge", this.connectionUrl);
|
|
4851
4847
|
});
|
|
4852
4848
|
this.centrifuge.on("error", (err) => {
|
|
4853
4849
|
console.error("Error connecting to centrifuge", err);
|
|
@@ -4921,7 +4917,7 @@ class WebsocketContextFactory {
|
|
|
4921
4917
|
static create(mechanism, args) {
|
|
4922
4918
|
let websocketProvider;
|
|
4923
4919
|
if (mechanism === "centrifugo") {
|
|
4924
|
-
websocketProvider = new CentrifugoWebsocket(args.connectionUrl);
|
|
4920
|
+
websocketProvider = new CentrifugoWebsocket(args.connectionUrl, args.token, args.userId);
|
|
4925
4921
|
}
|
|
4926
4922
|
websocketProvider == null ? void 0 : websocketProvider.connect();
|
|
4927
4923
|
return websocketProvider;
|