@vertexvis/stream-api
Advanced tools
Comparing version 0.7.0 to 0.7.1
@@ -38,4 +38,4 @@ 'use strict'; | ||
_this.removeWebSocketListeners(); | ||
if (_this.urlProvider != null) { | ||
_this.reconnect(_this.urlProvider); | ||
if (_this.descriptor != null) { | ||
_this.reconnect(_this.descriptor); | ||
} | ||
@@ -54,11 +54,9 @@ }; | ||
}; | ||
WebSocketClient.prototype.connect = function (urlProvider) { | ||
WebSocketClient.prototype.connect = function (descriptor) { | ||
return tslib.__awaiter(this, void 0, void 0, function () { | ||
var urlAndProtocol; | ||
var _this = this; | ||
return tslib.__generator(this, function (_a) { | ||
urlAndProtocol = urlProvider(); | ||
this.webSocket = new WebSocket(urlAndProtocol.url, urlAndProtocol.protocols); | ||
this.webSocket = new WebSocket(descriptor.url, descriptor.protocols); | ||
this.webSocket.binaryType = 'arraybuffer'; | ||
this.urlProvider = urlProvider; | ||
this.descriptor = descriptor; | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
@@ -83,3 +81,3 @@ if (_this.webSocket != null) { | ||
*/ | ||
WebSocketClient.prototype.reconnect = function (urlProvider) { | ||
WebSocketClient.prototype.reconnect = function (descriptor) { | ||
return tslib.__awaiter(this, void 0, void 0, function () { | ||
@@ -99,3 +97,3 @@ var e_1; | ||
_a.trys.push([2, 4, , 5]); | ||
return [4 /*yield*/, this.connect(urlProvider)]; | ||
return [4 /*yield*/, this.connect(descriptor)]; | ||
case 3: | ||
@@ -102,0 +100,0 @@ _a.sent(); |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("@vertexvis/utils"),n=require("@vertexvis/frame-streaming-protos"),r=[0,1e3,1e3,5e3],s=function(){function n(e){var n=this;void 0===e&&(e=r),this.reconnectDelays=e,this.onMessageDispatcher=new t.EventDispatcher,this.reopenAttempt=0,this.addWebSocketListeners=function(e,t,r){var s=function(){return n.onOpen(t)},o=function(){return r()};return e.addEventListener("message",n.handleMessage),e.addEventListener("open",s),e.addEventListener("error",o),e.addEventListener("close",n.handleClose),{dispose:function(){e.removeEventListener("message",n.handleMessage),e.removeEventListener("open",s),e.removeEventListener("error",o),e.removeEventListener("close",n.handleClose)}}},this.handleMessage=function(e){n.onMessageDispatcher.emit(e)},this.handleClose=function(){n.removeWebSocketListeners(),null!=n.urlProvider&&n.reconnect(n.urlProvider)}}return n.prototype.close=function(){null!=this.webSocket&&(this.removeWebSocketListeners(),this.webSocket.close(),null!=this.timer&&(window.clearTimeout(this.timer),this.webSocket=void 0))},n.prototype.connect=function(t){return e.__awaiter(this,void 0,void 0,(function(){var n,r=this;return e.__generator(this,(function(e){return n=t(),this.webSocket=new WebSocket(n.url,n.protocols),this.webSocket.binaryType="arraybuffer",this.urlProvider=t,[2,new Promise((function(e,t){null!=r.webSocket&&(r.listeners=r.addWebSocketListeners(r.webSocket,e,t))}))]}))}))},n.prototype.onMessage=function(e){return this.onMessageDispatcher.on(e)},n.prototype.send=function(e){null!=this.webSocket&&this.webSocket.send(e)},n.prototype.reconnect=function(t){return e.__awaiter(this,void 0,void 0,(function(){var n=this;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,new Promise((function(e){n.timer=window.setTimeout(e,n.reconnectDelays[Math.min(n.reopenAttempt,n.reconnectDelays.length-1)])}))];case 1:e.sent(),this.reopenAttempt+=1,e.label=2;case 2:return e.trys.push([2,4,,5]),[4,this.connect(t)];case 3:return e.sent(),[3,5];case 4:return e.sent(),[3,5];case 5:return[2]}}))}))},n.prototype.removeWebSocketListeners=function(){var e;null===(e=this.listeners)||void 0===e||e.dispose()},n.prototype.onOpen=function(e){this.reopenAttempt=0,e()},n}();var o=function(){function r(e){void 0===e&&(e=new s),this.websocket=e,this.onResponseDispatcher=new t.EventDispatcher,this.onRequestDispatcher=new t.EventDispatcher}return r.prototype.connect=function(t){return e.__awaiter(this,void 0,void 0,(function(){var n=this;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,this.websocket.connect(t)];case 1:return e.sent(),this.messageSubscription=this.websocket.onMessage((function(e){n.handleMessage(e)})),[2,{dispose:function(){return n.dispose()}}]}}))}))},r.prototype.dispose=function(){var e;this.websocket.close(),null===(e=this.messageSubscription)||void 0===e||e.dispose()},r.prototype.onRequest=function(e){return this.onRequestDispatcher.on(e)},r.prototype.startStream=function(e,t){return void 0===t&&(t=!0),this.sendRequest({startStream:e},t)},r.prototype.reconnect=function(t,n){return void 0===n&&(n=!0),e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,this.sendRequest({reconnect:t},n)]}))}))},r.prototype.beginInteraction=function(e){return void 0===e&&(e=!0),this.sendRequest({beginInteraction:{}},e)},r.prototype.replaceCamera=function(e,t){var n=e.camera;return void 0===t&&(t=!0),this.sendRequest({updateCamera:{camera:n}},t)},r.prototype.hitItems=function(e,t){var n=e.point;return void 0===t&&(t=!0),this.sendRequest({hitItems:{point:n}},t)},r.prototype.createSceneAlteration=function(e,t){return void 0===t&&(t=!0),this.sendRequest({createSceneAlteration:e},t)},r.prototype.endInteraction=function(e){return void 0===e&&(e=!0),this.sendRequest({endInteraction:{}},e)},r.prototype.sendRequest=function(r,s){var o=this;if(s){var i=t.UUID.create();return r=e.__assign({requestId:{value:i}},r),new Promise((function(e){var t=o.onResponse((function(n){var r;i===(null===(r=n.requestId)||void 0===r?void 0:r.value)&&(e(n),t.dispose())}));o.websocket.send(n.vertexvis.protobuf.stream.StreamMessage.encode({request:r}).finish())}))}return this.websocket.send(n.vertexvis.protobuf.stream.StreamMessage.encode({request:r}).finish()),Promise.resolve({})},r.prototype.handleMessage=function(e){var t,r,s=(t=e.data,r=new Uint8Array(t),n.vertexvis.protobuf.stream.StreamMessage.decode(r));null!=(null==s?void 0:s.response)&&this.onResponseDispatcher.emit(s.response),null!=(null==s?void 0:s.request)&&this.onRequestDispatcher.emit(s.request)},r.prototype.onResponse=function(e){return this.onResponseDispatcher.on(e)},r}();exports.StreamApi=o,exports.WebSocketClient=s; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("@vertexvis/utils"),n=require("@vertexvis/frame-streaming-protos"),s=[0,1e3,1e3,5e3],r=function(){function n(e){var n=this;void 0===e&&(e=s),this.reconnectDelays=e,this.onMessageDispatcher=new t.EventDispatcher,this.reopenAttempt=0,this.addWebSocketListeners=function(e,t,s){var r=function(){return n.onOpen(t)},o=function(){return s()};return e.addEventListener("message",n.handleMessage),e.addEventListener("open",r),e.addEventListener("error",o),e.addEventListener("close",n.handleClose),{dispose:function(){e.removeEventListener("message",n.handleMessage),e.removeEventListener("open",r),e.removeEventListener("error",o),e.removeEventListener("close",n.handleClose)}}},this.handleMessage=function(e){n.onMessageDispatcher.emit(e)},this.handleClose=function(){n.removeWebSocketListeners(),null!=n.descriptor&&n.reconnect(n.descriptor)}}return n.prototype.close=function(){null!=this.webSocket&&(this.removeWebSocketListeners(),this.webSocket.close(),null!=this.timer&&(window.clearTimeout(this.timer),this.webSocket=void 0))},n.prototype.connect=function(t){return e.__awaiter(this,void 0,void 0,(function(){var n=this;return e.__generator(this,(function(e){return this.webSocket=new WebSocket(t.url,t.protocols),this.webSocket.binaryType="arraybuffer",this.descriptor=t,[2,new Promise((function(e,t){null!=n.webSocket&&(n.listeners=n.addWebSocketListeners(n.webSocket,e,t))}))]}))}))},n.prototype.onMessage=function(e){return this.onMessageDispatcher.on(e)},n.prototype.send=function(e){null!=this.webSocket&&this.webSocket.send(e)},n.prototype.reconnect=function(t){return e.__awaiter(this,void 0,void 0,(function(){var n=this;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,new Promise((function(e){n.timer=window.setTimeout(e,n.reconnectDelays[Math.min(n.reopenAttempt,n.reconnectDelays.length-1)])}))];case 1:e.sent(),this.reopenAttempt+=1,e.label=2;case 2:return e.trys.push([2,4,,5]),[4,this.connect(t)];case 3:return e.sent(),[3,5];case 4:return e.sent(),[3,5];case 5:return[2]}}))}))},n.prototype.removeWebSocketListeners=function(){var e;null===(e=this.listeners)||void 0===e||e.dispose()},n.prototype.onOpen=function(e){this.reopenAttempt=0,e()},n}();var o=function(){function s(e){void 0===e&&(e=new r),this.websocket=e,this.onResponseDispatcher=new t.EventDispatcher,this.onRequestDispatcher=new t.EventDispatcher}return s.prototype.connect=function(t){return e.__awaiter(this,void 0,void 0,(function(){var n=this;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,this.websocket.connect(t)];case 1:return e.sent(),this.messageSubscription=this.websocket.onMessage((function(e){n.handleMessage(e)})),[2,{dispose:function(){return n.dispose()}}]}}))}))},s.prototype.dispose=function(){var e;this.websocket.close(),null===(e=this.messageSubscription)||void 0===e||e.dispose()},s.prototype.onRequest=function(e){return this.onRequestDispatcher.on(e)},s.prototype.startStream=function(e,t){return void 0===t&&(t=!0),this.sendRequest({startStream:e},t)},s.prototype.reconnect=function(t,n){return void 0===n&&(n=!0),e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,this.sendRequest({reconnect:t},n)]}))}))},s.prototype.beginInteraction=function(e){return void 0===e&&(e=!0),this.sendRequest({beginInteraction:{}},e)},s.prototype.replaceCamera=function(e,t){var n=e.camera;return void 0===t&&(t=!0),this.sendRequest({updateCamera:{camera:n}},t)},s.prototype.hitItems=function(e,t){var n=e.point;return void 0===t&&(t=!0),this.sendRequest({hitItems:{point:n}},t)},s.prototype.createSceneAlteration=function(e,t){return void 0===t&&(t=!0),this.sendRequest({createSceneAlteration:e},t)},s.prototype.endInteraction=function(e){return void 0===e&&(e=!0),this.sendRequest({endInteraction:{}},e)},s.prototype.sendRequest=function(s,r){var o=this;if(r){var i=t.UUID.create();return s=e.__assign({requestId:{value:i}},s),new Promise((function(e){var t=o.onResponse((function(n){var s;i===(null===(s=n.requestId)||void 0===s?void 0:s.value)&&(e(n),t.dispose())}));o.websocket.send(n.vertexvis.protobuf.stream.StreamMessage.encode({request:s}).finish())}))}return this.websocket.send(n.vertexvis.protobuf.stream.StreamMessage.encode({request:s}).finish()),Promise.resolve({})},s.prototype.handleMessage=function(e){var t,s,r=(t=e.data,s=new Uint8Array(t),n.vertexvis.protobuf.stream.StreamMessage.decode(s));null!=(null==r?void 0:r.response)&&this.onResponseDispatcher.emit(r.response),null!=(null==r?void 0:r.request)&&this.onRequestDispatcher.emit(r.request)},s.prototype.onResponse=function(e){return this.onResponseDispatcher.on(e)},s}();exports.StreamApi=o,exports.WebSocketClient=r; | ||
//# sourceMappingURL=bundle.cjs.min.js.map |
@@ -34,4 +34,4 @@ import { __awaiter, __generator, __assign } from 'tslib'; | ||
_this.removeWebSocketListeners(); | ||
if (_this.urlProvider != null) { | ||
_this.reconnect(_this.urlProvider); | ||
if (_this.descriptor != null) { | ||
_this.reconnect(_this.descriptor); | ||
} | ||
@@ -50,11 +50,9 @@ }; | ||
}; | ||
WebSocketClient.prototype.connect = function (urlProvider) { | ||
WebSocketClient.prototype.connect = function (descriptor) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var urlAndProtocol; | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
urlAndProtocol = urlProvider(); | ||
this.webSocket = new WebSocket(urlAndProtocol.url, urlAndProtocol.protocols); | ||
this.webSocket = new WebSocket(descriptor.url, descriptor.protocols); | ||
this.webSocket.binaryType = 'arraybuffer'; | ||
this.urlProvider = urlProvider; | ||
this.descriptor = descriptor; | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
@@ -79,3 +77,3 @@ if (_this.webSocket != null) { | ||
*/ | ||
WebSocketClient.prototype.reconnect = function (urlProvider) { | ||
WebSocketClient.prototype.reconnect = function (descriptor) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -95,3 +93,3 @@ var e_1; | ||
_a.trys.push([2, 4, , 5]); | ||
return [4 /*yield*/, this.connect(urlProvider)]; | ||
return [4 /*yield*/, this.connect(descriptor)]; | ||
case 3: | ||
@@ -98,0 +96,0 @@ _a.sent(); |
@@ -1,2 +0,2 @@ | ||
import{__awaiter as e,__generator as t,__assign as n}from"tslib";import{EventDispatcher as o,UUID as s}from"@vertexvis/utils";import{vertexvis as r}from"@vertexvis/frame-streaming-protos";var i=[0,1e3,1e3,5e3],c=function(){function n(e){var t=this;void 0===e&&(e=i),this.reconnectDelays=e,this.onMessageDispatcher=new o,this.reopenAttempt=0,this.addWebSocketListeners=function(e,n,o){var s=function(){return t.onOpen(n)},r=function(){return o()};return e.addEventListener("message",t.handleMessage),e.addEventListener("open",s),e.addEventListener("error",r),e.addEventListener("close",t.handleClose),{dispose:function(){e.removeEventListener("message",t.handleMessage),e.removeEventListener("open",s),e.removeEventListener("error",r),e.removeEventListener("close",t.handleClose)}}},this.handleMessage=function(e){t.onMessageDispatcher.emit(e)},this.handleClose=function(){t.removeWebSocketListeners(),null!=t.urlProvider&&t.reconnect(t.urlProvider)}}return n.prototype.close=function(){null!=this.webSocket&&(this.removeWebSocketListeners(),this.webSocket.close(),null!=this.timer&&(window.clearTimeout(this.timer),this.webSocket=void 0))},n.prototype.connect=function(n){return e(this,void 0,void 0,(function(){var e,o=this;return t(this,(function(t){return e=n(),this.webSocket=new WebSocket(e.url,e.protocols),this.webSocket.binaryType="arraybuffer",this.urlProvider=n,[2,new Promise((function(e,t){null!=o.webSocket&&(o.listeners=o.addWebSocketListeners(o.webSocket,e,t))}))]}))}))},n.prototype.onMessage=function(e){return this.onMessageDispatcher.on(e)},n.prototype.send=function(e){null!=this.webSocket&&this.webSocket.send(e)},n.prototype.reconnect=function(n){return e(this,void 0,void 0,(function(){var e=this;return t(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t){e.timer=window.setTimeout(t,e.reconnectDelays[Math.min(e.reopenAttempt,e.reconnectDelays.length-1)])}))];case 1:t.sent(),this.reopenAttempt+=1,t.label=2;case 2:return t.trys.push([2,4,,5]),[4,this.connect(n)];case 3:return t.sent(),[3,5];case 4:return t.sent(),[3,5];case 5:return[2]}}))}))},n.prototype.removeWebSocketListeners=function(){var e;null===(e=this.listeners)||void 0===e||e.dispose()},n.prototype.onOpen=function(e){this.reopenAttempt=0,e()},n}();var u=function(){function i(e){void 0===e&&(e=new c),this.websocket=e,this.onResponseDispatcher=new o,this.onRequestDispatcher=new o}return i.prototype.connect=function(n){return e(this,void 0,void 0,(function(){var e=this;return t(this,(function(t){switch(t.label){case 0:return[4,this.websocket.connect(n)];case 1:return t.sent(),this.messageSubscription=this.websocket.onMessage((function(t){e.handleMessage(t)})),[2,{dispose:function(){return e.dispose()}}]}}))}))},i.prototype.dispose=function(){var e;this.websocket.close(),null===(e=this.messageSubscription)||void 0===e||e.dispose()},i.prototype.onRequest=function(e){return this.onRequestDispatcher.on(e)},i.prototype.startStream=function(e,t){return void 0===t&&(t=!0),this.sendRequest({startStream:e},t)},i.prototype.reconnect=function(n,o){return void 0===o&&(o=!0),e(this,void 0,void 0,(function(){return t(this,(function(e){return[2,this.sendRequest({reconnect:n},o)]}))}))},i.prototype.beginInteraction=function(e){return void 0===e&&(e=!0),this.sendRequest({beginInteraction:{}},e)},i.prototype.replaceCamera=function(e,t){var n=e.camera;return void 0===t&&(t=!0),this.sendRequest({updateCamera:{camera:n}},t)},i.prototype.hitItems=function(e,t){var n=e.point;return void 0===t&&(t=!0),this.sendRequest({hitItems:{point:n}},t)},i.prototype.createSceneAlteration=function(e,t){return void 0===t&&(t=!0),this.sendRequest({createSceneAlteration:e},t)},i.prototype.endInteraction=function(e){return void 0===e&&(e=!0),this.sendRequest({endInteraction:{}},e)},i.prototype.sendRequest=function(e,t){var o=this;if(t){var i=s.create();return e=n({requestId:{value:i}},e),new Promise((function(t){var n=o.onResponse((function(e){var o;i===(null===(o=e.requestId)||void 0===o?void 0:o.value)&&(t(e),n.dispose())}));o.websocket.send(r.protobuf.stream.StreamMessage.encode({request:e}).finish())}))}return this.websocket.send(r.protobuf.stream.StreamMessage.encode({request:e}).finish()),Promise.resolve({})},i.prototype.handleMessage=function(e){var t,n,o=(t=e.data,n=new Uint8Array(t),r.protobuf.stream.StreamMessage.decode(n));null!=(null==o?void 0:o.response)&&this.onResponseDispatcher.emit(o.response),null!=(null==o?void 0:o.request)&&this.onRequestDispatcher.emit(o.request)},i.prototype.onResponse=function(e){return this.onResponseDispatcher.on(e)},i}();export{u as StreamApi,c as WebSocketClient}; | ||
import{__awaiter as e,__generator as t,__assign as n}from"tslib";import{EventDispatcher as o,UUID as s}from"@vertexvis/utils";import{vertexvis as r}from"@vertexvis/frame-streaming-protos";var i=[0,1e3,1e3,5e3],c=function(){function n(e){var t=this;void 0===e&&(e=i),this.reconnectDelays=e,this.onMessageDispatcher=new o,this.reopenAttempt=0,this.addWebSocketListeners=function(e,n,o){var s=function(){return t.onOpen(n)},r=function(){return o()};return e.addEventListener("message",t.handleMessage),e.addEventListener("open",s),e.addEventListener("error",r),e.addEventListener("close",t.handleClose),{dispose:function(){e.removeEventListener("message",t.handleMessage),e.removeEventListener("open",s),e.removeEventListener("error",r),e.removeEventListener("close",t.handleClose)}}},this.handleMessage=function(e){t.onMessageDispatcher.emit(e)},this.handleClose=function(){t.removeWebSocketListeners(),null!=t.descriptor&&t.reconnect(t.descriptor)}}return n.prototype.close=function(){null!=this.webSocket&&(this.removeWebSocketListeners(),this.webSocket.close(),null!=this.timer&&(window.clearTimeout(this.timer),this.webSocket=void 0))},n.prototype.connect=function(n){return e(this,void 0,void 0,(function(){var e=this;return t(this,(function(t){return this.webSocket=new WebSocket(n.url,n.protocols),this.webSocket.binaryType="arraybuffer",this.descriptor=n,[2,new Promise((function(t,n){null!=e.webSocket&&(e.listeners=e.addWebSocketListeners(e.webSocket,t,n))}))]}))}))},n.prototype.onMessage=function(e){return this.onMessageDispatcher.on(e)},n.prototype.send=function(e){null!=this.webSocket&&this.webSocket.send(e)},n.prototype.reconnect=function(n){return e(this,void 0,void 0,(function(){var e=this;return t(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t){e.timer=window.setTimeout(t,e.reconnectDelays[Math.min(e.reopenAttempt,e.reconnectDelays.length-1)])}))];case 1:t.sent(),this.reopenAttempt+=1,t.label=2;case 2:return t.trys.push([2,4,,5]),[4,this.connect(n)];case 3:return t.sent(),[3,5];case 4:return t.sent(),[3,5];case 5:return[2]}}))}))},n.prototype.removeWebSocketListeners=function(){var e;null===(e=this.listeners)||void 0===e||e.dispose()},n.prototype.onOpen=function(e){this.reopenAttempt=0,e()},n}();var u=function(){function i(e){void 0===e&&(e=new c),this.websocket=e,this.onResponseDispatcher=new o,this.onRequestDispatcher=new o}return i.prototype.connect=function(n){return e(this,void 0,void 0,(function(){var e=this;return t(this,(function(t){switch(t.label){case 0:return[4,this.websocket.connect(n)];case 1:return t.sent(),this.messageSubscription=this.websocket.onMessage((function(t){e.handleMessage(t)})),[2,{dispose:function(){return e.dispose()}}]}}))}))},i.prototype.dispose=function(){var e;this.websocket.close(),null===(e=this.messageSubscription)||void 0===e||e.dispose()},i.prototype.onRequest=function(e){return this.onRequestDispatcher.on(e)},i.prototype.startStream=function(e,t){return void 0===t&&(t=!0),this.sendRequest({startStream:e},t)},i.prototype.reconnect=function(n,o){return void 0===o&&(o=!0),e(this,void 0,void 0,(function(){return t(this,(function(e){return[2,this.sendRequest({reconnect:n},o)]}))}))},i.prototype.beginInteraction=function(e){return void 0===e&&(e=!0),this.sendRequest({beginInteraction:{}},e)},i.prototype.replaceCamera=function(e,t){var n=e.camera;return void 0===t&&(t=!0),this.sendRequest({updateCamera:{camera:n}},t)},i.prototype.hitItems=function(e,t){var n=e.point;return void 0===t&&(t=!0),this.sendRequest({hitItems:{point:n}},t)},i.prototype.createSceneAlteration=function(e,t){return void 0===t&&(t=!0),this.sendRequest({createSceneAlteration:e},t)},i.prototype.endInteraction=function(e){return void 0===e&&(e=!0),this.sendRequest({endInteraction:{}},e)},i.prototype.sendRequest=function(e,t){var o=this;if(t){var i=s.create();return e=n({requestId:{value:i}},e),new Promise((function(t){var n=o.onResponse((function(e){var o;i===(null===(o=e.requestId)||void 0===o?void 0:o.value)&&(t(e),n.dispose())}));o.websocket.send(r.protobuf.stream.StreamMessage.encode({request:e}).finish())}))}return this.websocket.send(r.protobuf.stream.StreamMessage.encode({request:e}).finish()),Promise.resolve({})},i.prototype.handleMessage=function(e){var t,n,o=(t=e.data,n=new Uint8Array(t),r.protobuf.stream.StreamMessage.decode(n));null!=(null==o?void 0:o.response)&&this.onResponseDispatcher.emit(o.response),null!=(null==o?void 0:o.request)&&this.onRequestDispatcher.emit(o.request)},i.prototype.onResponse=function(e){return this.onResponseDispatcher.on(e)},i}();export{u as StreamApi,c as WebSocketClient}; | ||
//# sourceMappingURL=bundle.esm.min.js.map |
export * from './streamApi'; | ||
export * from './webSocketClient'; | ||
export * from './url'; | ||
export * from './connection'; |
import { WebSocketClient } from './webSocketClient'; | ||
import { UrlProvider } from './url'; | ||
import { ConnectionDescriptor } from './connection'; | ||
import { HitItemsPayload, ReconnectPayload, ReplaceCameraPayload, StartStreamPayload } from './types'; | ||
@@ -24,3 +24,3 @@ import { vertexvis } from '@vertexvis/frame-streaming-protos'; | ||
*/ | ||
connect(descriptor: UrlProvider): Promise<Disposable>; | ||
connect(descriptor: ConnectionDescriptor): Promise<Disposable>; | ||
/** | ||
@@ -27,0 +27,0 @@ * Closes any open WS connections and disposes of resources. |
import { DeepRequired } from '@vertexvis/utils'; | ||
import { vertexvis } from '@vertexvis/frame-streaming-protos'; | ||
export declare type StartStreamPayload = DeepRequired<vertexvis.protobuf.stream.IStartStreamPayload, ['frameCorrelationId']>; | ||
export declare type ReconnectPayload = DeepRequired<vertexvis.protobuf.stream.IReconnectPayload, ['frameCorrelationId']>; | ||
export declare type StartStreamPayload = DeepRequired<vertexvis.protobuf.stream.IStartStreamPayload, ['frameCorrelationId'] | ['frameBackgroundColor']>; | ||
export declare type ReconnectPayload = DeepRequired<vertexvis.protobuf.stream.IReconnectPayload, ['frameCorrelationId'] | ['frameBackgroundColor']>; | ||
export declare type ReplaceCameraPayload = DeepRequired<vertexvis.protobuf.stream.IUpdateCameraPayload, ['frameCorrelationId']>; | ||
export declare type HitItemsPayload = DeepRequired<vertexvis.protobuf.stream.IHitItemsPayload, []>; |
import { Disposable } from '@vertexvis/utils'; | ||
import { UrlProvider } from './url'; | ||
import { ConnectionDescriptor } from './connection'; | ||
export declare type WebSocketSendData = string | ArrayBufferLike | Blob | ArrayBufferView; | ||
@@ -10,3 +10,3 @@ declare type MessageHandler = (event: MessageEvent) => void; | ||
private reopenAttempt; | ||
private urlProvider?; | ||
private descriptor?; | ||
private timer?; | ||
@@ -16,3 +16,3 @@ private listeners?; | ||
close(): void; | ||
connect(urlProvider: UrlProvider): Promise<void>; | ||
connect(descriptor: ConnectionDescriptor): Promise<void>; | ||
onMessage(handler: MessageHandler): Disposable; | ||
@@ -23,3 +23,3 @@ send(data: WebSocketSendData): void; | ||
*/ | ||
reconnect(urlProvider: UrlProvider): Promise<void>; | ||
reconnect(descriptor: ConnectionDescriptor): Promise<void>; | ||
private addWebSocketListeners; | ||
@@ -26,0 +26,0 @@ private removeWebSocketListeners; |
{ | ||
"name": "@vertexvis/stream-api", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"description": "A websocket client for interacting with Vertex's stream API.", | ||
@@ -38,4 +38,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"@vertexvis/frame-streaming-protos": "^0.1.0", | ||
"@vertexvis/utils": "0.7.0" | ||
"@vertexvis/frame-streaming-protos": "^0.1.3", | ||
"@vertexvis/utils": "0.7.1" | ||
}, | ||
@@ -46,3 +46,3 @@ "devDependencies": { | ||
"@vertexvis/jest-config-vertexvis": "0.4.4", | ||
"@vertexwebsdk/build": "0.7.0", | ||
"@vertexwebsdk/build": "0.7.1", | ||
"eslint": "^6.1.0", | ||
@@ -58,3 +58,3 @@ "jest": "^24.9.0", | ||
}, | ||
"gitHead": "4c68622442cc412f3e4c7e49ecc4401e4bd9dbf6" | ||
"gitHead": "c88f8a49b2d66c0615524499b3ba4f29595004a3" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
126796
933
+ Added@vertexvis/utils@0.7.1(transitive)
- Removed@vertexvis/utils@0.7.0(transitive)
Updated@vertexvis/utils@0.7.1