@upcoming/bee-js 0.15.0 → 0.15.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.
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.subscribe = exports.send = void 0;
7
+ const cafe_utility_1 = require("cafe-utility");
7
8
  const isomorphic_ws_1 = __importDefault(require("isomorphic-ws"));
8
9
  const soc_1 = require("../chunk/soc");
9
10
  const endpoint = 'gsoc';
@@ -13,6 +14,9 @@ async function send(requestOptions, soc, stamp, options) {
13
14
  exports.send = send;
14
15
  function subscribe(url, reference, headers) {
15
16
  const wsUrl = url.replace(/^http/i, 'ws');
17
+ if (cafe_utility_1.System.whereAmI() === 'browser') {
18
+ return new isomorphic_ws_1.default(`${wsUrl}/${endpoint}/subscribe/${reference.toHex()}`);
19
+ }
16
20
  return new isomorphic_ws_1.default(`${wsUrl}/${endpoint}/subscribe/${reference.toHex()}`, {
17
21
  headers,
18
22
  });
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.subscribe = exports.send = void 0;
7
+ const cafe_utility_1 = require("cafe-utility");
7
8
  const isomorphic_ws_1 = __importDefault(require("isomorphic-ws"));
8
9
  const headers_1 = require("../utils/headers");
9
10
  const http_1 = require("../utils/http");
@@ -38,6 +39,9 @@ exports.send = send;
38
39
  */
39
40
  function subscribe(url, topic, headers) {
40
41
  const wsUrl = url.replace(/^http/i, 'ws');
42
+ if (cafe_utility_1.System.whereAmI() === 'browser') {
43
+ return new isomorphic_ws_1.default(`${wsUrl}/${endpoint}/subscribe/${topic.toHex()}`);
44
+ }
41
45
  return new isomorphic_ws_1.default(`${wsUrl}/${endpoint}/subscribe/${topic.toHex()}`, {
42
46
  headers,
43
47
  });