Skip to content

Commit 94b181a

Browse files
Merge pull request #70 from Workiva/no-info-req
remove info request
2 parents b36cffa + 6104d7b commit 94b181a

6 files changed

Lines changed: 13 additions & 30 deletions

File tree

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# SockJS Client Wrapper
22

3-
A Dart wrapper around the [SockJS Client][sockjs-client]. Uses the
4-
[`js` Dart package][js-dart-package] to interop with the JS lib.
3+
A Dart wrapper around the [SockJS Client][sockjs-client]. Uses the [`js` Dart package][js-dart-package] to interop with the JS lib. The JS lib is vendored at [`lib/sockjs.js`](./lib/sockjs.js). The vendored lib is of sockjs-client v1.6.1 with one modification: the client does not make a `/info` request when establishing the connection.
54

65
## Usage
76

lib/sockjs.js

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* sockjs-client v1.6.1 | http://sockjs.org | MIT license */
1+
/* extension of sockjs-client v1.6.1 | http://sockjs.org | MIT license */
22
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.SockJS = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
33
(function (global){(function (){
44
'use strict';
@@ -542,25 +542,8 @@ InfoReceiver._getReceiver = function(baseUrl, url, urlInfo) {
542542
return new InfoAjax(url, XHRFake);
543543
};
544544

545-
InfoReceiver.prototype.doXhr = function(baseUrl, urlInfo) {
546-
var self = this
547-
, url = urlUtils.addPath(baseUrl, '/info')
548-
;
549-
debug('doXhr', url);
550-
551-
this.xo = InfoReceiver._getReceiver(baseUrl, url, urlInfo);
552-
553-
this.timeoutRef = setTimeout(function() {
554-
debug('timeout');
555-
self._cleanup(false);
556-
self.emit('finish');
557-
}, InfoReceiver.timeout);
558-
559-
this.xo.once('finish', function(info, rtt) {
560-
debug('finish', info, rtt);
561-
self._cleanup(true);
562-
self.emit('finish', info, rtt);
563-
});
545+
InfoReceiver.prototype.doXhr = function(_baseUrl, _urlInfo) {
546+
this.emit('finish', {}, window.navigator.connection?.rtt || 100);
564547
};
565548

566549
InfoReceiver.prototype._cleanup = function(wasClean) {
@@ -5228,6 +5211,3 @@ module.exports = Url;
52285211

52295212
},{"querystringify":58,"requires-port":59}]},{},[1])(1)
52305213
});
5231-
5232-
5233-
//# sourceMappingURL=sockjs.js.map

lib/sockjs.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/sockjs_prod.js

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/sockjs_prod.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,11 @@
55
"dependencies": {
66
"sockjs": "^0.3.19"
77
},
8+
"devDependencies": {
9+
"terser": "^5.30.0"
10+
},
11+
"scripts": {
12+
"build": "terser lib/sockjs.js --source-map url=sockjs_prod.js.map -o lib/sockjs_prod.js"
13+
},
814
"private": true
915
}

0 commit comments

Comments
 (0)