@atlaskit/collab-provider 10.18.0 → 10.19.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/collab-provider
2
2
 
3
+ ## 10.19.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 10.19.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#165804](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/165804)
14
+ [`0480ffe1dfd8e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0480ffe1dfd8e) -
15
+ Use WebSocket first, polling later strategy, eliminate the need of the cloudId check
16
+
3
17
  ## 10.18.0
4
18
 
5
19
  ### Minor Changes
@@ -4,7 +4,7 @@
4
4
  "declaration": true,
5
5
  "target": "es5",
6
6
  "composite": true,
7
- "outDir": "../dist",
7
+ "outDir": "../../../../../confluence/tsDist/@atlaskit__collab-provider",
8
8
  "rootDir": "../"
9
9
  },
10
10
  "include": [
@@ -17,15 +17,15 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
17
17
  function createSocketIOSocket(url, auth, productInfo, isPresenceOnly) {
18
18
  var _URL = new URL(url),
19
19
  pathname = _URL.pathname;
20
- // Poll mode is default ON
20
+ // Polling first
21
21
  var transports = ['polling', 'websocket'];
22
22
  // Only limit this change to Presence only
23
- // Only make the change to those tenants who do not need the polling
24
- // WebSocket only is under a FG
25
23
  if (isPresenceOnly && (0, _platformFeatureFlags.fg)('platform-editor-presence-websocket-only')) {
26
- transports = ['websocket'];
24
+ // https://socket.io/docs/v4/client-options/#transports
25
+ // WebSocket first, if fails, try polling
26
+ transports = ['websocket', 'polling'];
27
27
  }
28
- return (0, _socket.io)(url, {
28
+ var client = (0, _socket.io)(url, {
29
29
  reconnectionDelayMax: _config.SOCKET_IO_OPTIONS.RECONNECTION_DELAY_MAX,
30
30
  reconnectionDelay: _config.SOCKET_IO_OPTIONS.RECONNECTION_DELAY,
31
31
  randomizationFactor: _config.SOCKET_IO_OPTIONS.RANDOMIZATION_FACTOR,
@@ -39,6 +39,16 @@ function createSocketIOSocket(url, auth, productInfo, isPresenceOnly) {
39
39
  'x-subproduct': (0, _utils.getSubProduct)(productInfo)
40
40
  }
41
41
  });
42
+
43
+ // Only limit this change to Presence only
44
+ if (isPresenceOnly && (0, _platformFeatureFlags.fg)('platform-editor-presence-websocket-only')) {
45
+ // https://socket.io/docs/v4/client-options/#transports
46
+ client.on('connect_error', function () {
47
+ // revert to classic upgrade
48
+ client.io.opts.transports = ['polling', 'websocket'];
49
+ });
50
+ }
51
+ return client;
42
52
  }
43
53
  function createSocketIOCollabProvider(config) {
44
54
  return new _provider.Provider(_objectSpread(_objectSpread({}, config), {}, {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/collab-provider";
8
- var version = exports.version = "10.18.0";
8
+ var version = exports.version = "10.19.1";
9
9
  var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
10
10
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
11
11
  };
@@ -7,15 +7,15 @@ export function createSocketIOSocket(url, auth, productInfo, isPresenceOnly) {
7
7
  const {
8
8
  pathname
9
9
  } = new URL(url);
10
- // Poll mode is default ON
10
+ // Polling first
11
11
  let transports = ['polling', 'websocket'];
12
12
  // Only limit this change to Presence only
13
- // Only make the change to those tenants who do not need the polling
14
- // WebSocket only is under a FG
15
13
  if (isPresenceOnly && fg('platform-editor-presence-websocket-only')) {
16
- transports = ['websocket'];
14
+ // https://socket.io/docs/v4/client-options/#transports
15
+ // WebSocket first, if fails, try polling
16
+ transports = ['websocket', 'polling'];
17
17
  }
18
- return io(url, {
18
+ const client = io(url, {
19
19
  reconnectionDelayMax: SOCKET_IO_OPTIONS.RECONNECTION_DELAY_MAX,
20
20
  reconnectionDelay: SOCKET_IO_OPTIONS.RECONNECTION_DELAY,
21
21
  randomizationFactor: SOCKET_IO_OPTIONS.RANDOMIZATION_FACTOR,
@@ -29,6 +29,16 @@ export function createSocketIOSocket(url, auth, productInfo, isPresenceOnly) {
29
29
  'x-subproduct': getSubProduct(productInfo)
30
30
  }
31
31
  });
32
+
33
+ // Only limit this change to Presence only
34
+ if (isPresenceOnly && fg('platform-editor-presence-websocket-only')) {
35
+ // https://socket.io/docs/v4/client-options/#transports
36
+ client.on('connect_error', () => {
37
+ // revert to classic upgrade
38
+ client.io.opts.transports = ['polling', 'websocket'];
39
+ });
40
+ }
41
+ return client;
32
42
  }
33
43
  export function createSocketIOCollabProvider(config) {
34
44
  return new Provider({
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/collab-provider";
2
- export const version = "10.18.0";
2
+ export const version = "10.19.1";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -9,15 +9,15 @@ import { SOCKET_IO_OPTIONS } from './config';
9
9
  export function createSocketIOSocket(url, auth, productInfo, isPresenceOnly) {
10
10
  var _URL = new URL(url),
11
11
  pathname = _URL.pathname;
12
- // Poll mode is default ON
12
+ // Polling first
13
13
  var transports = ['polling', 'websocket'];
14
14
  // Only limit this change to Presence only
15
- // Only make the change to those tenants who do not need the polling
16
- // WebSocket only is under a FG
17
15
  if (isPresenceOnly && fg('platform-editor-presence-websocket-only')) {
18
- transports = ['websocket'];
16
+ // https://socket.io/docs/v4/client-options/#transports
17
+ // WebSocket first, if fails, try polling
18
+ transports = ['websocket', 'polling'];
19
19
  }
20
- return io(url, {
20
+ var client = io(url, {
21
21
  reconnectionDelayMax: SOCKET_IO_OPTIONS.RECONNECTION_DELAY_MAX,
22
22
  reconnectionDelay: SOCKET_IO_OPTIONS.RECONNECTION_DELAY,
23
23
  randomizationFactor: SOCKET_IO_OPTIONS.RANDOMIZATION_FACTOR,
@@ -31,6 +31,16 @@ export function createSocketIOSocket(url, auth, productInfo, isPresenceOnly) {
31
31
  'x-subproduct': getSubProduct(productInfo)
32
32
  }
33
33
  });
34
+
35
+ // Only limit this change to Presence only
36
+ if (isPresenceOnly && fg('platform-editor-presence-websocket-only')) {
37
+ // https://socket.io/docs/v4/client-options/#transports
38
+ client.on('connect_error', function () {
39
+ // revert to classic upgrade
40
+ client.io.opts.transports = ['polling', 'websocket'];
41
+ });
42
+ }
43
+ return client;
34
44
  }
35
45
  export function createSocketIOCollabProvider(config) {
36
46
  return new Provider(_objectSpread(_objectSpread({}, config), {}, {
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/collab-provider";
2
- export var version = "10.18.0";
2
+ export var version = "10.19.1";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/collab-provider",
3
- "version": "10.18.0",
3
+ "version": "10.19.1",
4
4
  "description": "A provider for collaborative editing.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -35,14 +35,14 @@
35
35
  "@atlaskit/adf-utils": "^19.20.0",
36
36
  "@atlaskit/analytics-gas-types": "^5.1.0",
37
37
  "@atlaskit/analytics-listeners": "^9.0.0",
38
- "@atlaskit/editor-common": "^106.1.0",
38
+ "@atlaskit/editor-common": "^106.5.0",
39
39
  "@atlaskit/editor-json-transformer": "^8.24.0",
40
40
  "@atlaskit/editor-prosemirror": "7.0.0",
41
41
  "@atlaskit/feature-gate-js-client": "^5.3.0",
42
42
  "@atlaskit/platform-feature-flags": "^1.1.0",
43
43
  "@atlaskit/prosemirror-collab": "^0.17.0",
44
44
  "@atlaskit/react-ufo": "^3.13.0",
45
- "@atlaskit/tmp-editor-statsig": "^5.11.0",
45
+ "@atlaskit/tmp-editor-statsig": "^6.0.0",
46
46
  "@atlaskit/ufo": "^0.4.0",
47
47
  "@atlaskit/util-service-support": "^6.3.0",
48
48
  "@babel/runtime": "^7.0.0",