@slack/socket-mode
Advanced tools
Comparing version 1.3.4 to 1.3.5-rc.1
@@ -47,7 +47,6 @@ "use strict"; | ||
Event["ServerHello"] = "server hello"; | ||
Event["ServerDisconnectWarning"] = "server disconnect warning"; | ||
Event["ServerDisconnectOldSocket"] = "server disconnect old socket"; | ||
Event["ServerExplicitDisconnect"] = "server explicit disconnect"; | ||
Event["ServerPingsNotReceived"] = "server pings not received"; | ||
Event["ServerPongsNotReceived"] = "server pongs not received"; | ||
Event["ExplicitDisconnect"] = "explicit disconnect"; | ||
Event["ClientExplicitDisconnect"] = "client explicit disconnect"; | ||
Event["UnableToSocketModeStart"] = "unable_to_socket_mode_start"; | ||
@@ -98,3 +97,3 @@ })(Event || (Event = {})); | ||
.state(ConnectingState.Reconnecting) | ||
.do(async () => { | ||
.do(() => new Promise((res, _rej) => { | ||
// Trying to reconnect after waiting for a bit... | ||
@@ -106,4 +105,6 @@ this.numOfConsecutiveReconnectionFailures += 1; | ||
this.emit(ConnectingState.Authenticating); | ||
res(true); | ||
}, millisBeforeRetry); | ||
}) | ||
})) | ||
.onSuccess().transitionTo(ConnectingState.Authenticating) | ||
.onFailure().transitionTo(ConnectingState.Failed) | ||
@@ -158,2 +159,4 @@ .state(ConnectingState.Authenticated) | ||
.transitionTo(State.Connecting) | ||
.on(Event.ClientExplicitDisconnect) | ||
.transitionTo(State.Disconnected) | ||
.state(State.Connecting) | ||
@@ -169,3 +172,3 @@ .onEnter(() => { | ||
.transitionTo(State.Disconnecting) | ||
.on(Event.ExplicitDisconnect) | ||
.on(Event.ClientExplicitDisconnect) | ||
.transitionTo(State.Disconnecting) | ||
@@ -188,3 +191,3 @@ .on(Event.Failure) | ||
.transitionTo(State.Disconnecting) | ||
.on(Event.ExplicitDisconnect) | ||
.on(Event.ClientExplicitDisconnect) | ||
.transitionTo(State.Disconnecting) | ||
@@ -198,8 +201,5 @@ .withAction(() => this.markCurrentWebSocketAsInactive()) | ||
.transitionTo(State.Disconnecting) | ||
.on(Event.ServerDisconnectWarning) | ||
.on(Event.ServerExplicitDisconnect) | ||
.transitionTo(State.Reconnecting).withCondition(this.autoReconnectCondition.bind(this)) | ||
.transitionTo(State.Disconnecting) | ||
.on(Event.ServerDisconnectOldSocket) | ||
.transitionTo(State.Reconnecting).withCondition(this.autoReconnectCondition.bind(this)) | ||
.transitionTo(State.Disconnecting) | ||
.onExit(() => { | ||
@@ -302,3 +302,3 @@ this.terminateActiveHeartBeatJobs(); | ||
// Delegate behavior to state machine | ||
this.stateMachine.handle(Event.ExplicitDisconnect); | ||
this.stateMachine.handle(Event.ClientExplicitDisconnect); | ||
}); | ||
@@ -613,14 +613,8 @@ } | ||
} | ||
// Open the second WebSocket connection in preparation for the existing WebSocket disconnecting | ||
if (event.type === 'disconnect' && event.reason === 'warning') { | ||
this.logger.debug('Received "disconnect" (warning) message - creating the second connection'); | ||
this.stateMachine.handle(Event.ServerDisconnectWarning); | ||
if (event.type === 'disconnect') { | ||
// Refresh the WebSocket connection when prompted by Slack backend | ||
this.logger.debug(`Received "disconnect" (reason: ${event.reason}) message - will ${this.autoReconnectEnabled ? 'attempt reconnect' : 'disconnect (due to autoReconnectEnabled=false)'}`); | ||
this.stateMachine.handle(Event.ServerExplicitDisconnect); | ||
return; | ||
} | ||
// Close the primary WebSocket in favor of secondary WebSocket, assign secondary to primary | ||
if (event.type === 'disconnect' && event.reason === 'refresh_requested') { | ||
this.logger.debug('Received "disconnect" (refresh requested) message - closing the old WebSocket connection'); | ||
this.stateMachine.handle(Event.ServerDisconnectOldSocket); | ||
return; | ||
} | ||
// Define Ack | ||
@@ -627,0 +621,0 @@ const ack = async (response) => { |
{ | ||
"name": "@slack/socket-mode", | ||
"version": "1.3.4", | ||
"version": "1.3.5-rc.1", | ||
"description": "Official library for using the Slack Platform's Socket Mode API", | ||
@@ -43,3 +43,4 @@ "author": "Slack Technologies, LLC", | ||
"lint": "eslint --ext .ts src", | ||
"test": "npm run lint && npm run build && nyc mocha --config .mocharc.json src/*.spec.js", | ||
"test": "npm run lint && npm run build && nyc mocha --config .mocharc.json src/*.spec.js && npm run test:integration", | ||
"test:integration": "mocha --config .mocharc.json test/integration.spec.js", | ||
"watch": "npx nodemon --watch 'src' --ext 'ts' --exec npm run build" | ||
@@ -51,8 +52,5 @@ }, | ||
"@types/node": ">=12.0.0", | ||
"@types/p-queue": "^2.3.2", | ||
"@types/ws": "^7.4.7", | ||
"eventemitter3": "^3.1.0", | ||
"eventemitter3": "^5", | ||
"finity": "^0.5.4", | ||
"p-cancelable": "^1.1.0", | ||
"p-queue": "^2.4.2", | ||
"ws": "^7.5.3" | ||
@@ -59,0 +57,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7
85149
1029
1
+ Addedeventemitter3@5.0.1(transitive)
- Removed@types/p-queue@^2.3.2
- Removedp-cancelable@^1.1.0
- Removedp-queue@^2.4.2
- Removed@types/p-queue@2.3.2(transitive)
- Removedp-cancelable@1.1.0(transitive)
- Removedp-queue@2.4.2(transitive)
Updatedeventemitter3@^5