UNPKG

1.43 kBJavaScriptView Raw
1var __extends = (this && this.__extends) || (function () {
2 var extendStatics = function (d, b) {
3 extendStatics = Object.setPrototypeOf ||
4 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6 return extendStatics(d, b);
7 }
8 return function (d, b) {
9 extendStatics(d, b);
10 function __() { this.constructor = d; }
11 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12 };
13})();
14import { ApolloLink } from 'apollo-link';
15import { SubscriptionClient } from 'subscriptions-transport-ws';
16var WebSocketLink = /** @class */ (function (_super) {
17 __extends(WebSocketLink, _super);
18 function WebSocketLink(paramsOrClient) {
19 var _this = _super.call(this) || this;
20 if (paramsOrClient instanceof SubscriptionClient) {
21 _this.subscriptionClient = paramsOrClient;
22 }
23 else {
24 _this.subscriptionClient = new SubscriptionClient(paramsOrClient.uri, paramsOrClient.options, paramsOrClient.webSocketImpl);
25 }
26 return _this;
27 }
28 WebSocketLink.prototype.request = function (operation) {
29 return this.subscriptionClient.request(operation);
30 };
31 return WebSocketLink;
32}(ApolloLink));
33export { WebSocketLink };
34//# sourceMappingURL=webSocketLink.js.map
\No newline at end of file