UNPKG

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