-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
superagent
replacement and web worker for web
#367
Conversation
Separate transport provider for browser version of PubNub SDK to provide better user experience. feat(types): client interface rewritten with TypeScript Client interface rewritten with TypeScript which gives up-tp-date interface.
refactor(error): update error payload and emit status object types refactor(build): update target and module to `ES6`
src/web/configuration.ts
Outdated
/** | ||
* Whether PubNub client should try utilize existing TCP connection for new requests or not. | ||
*/ | ||
const KEEP_ALIVE = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! to keep it true default.
also, assuming that it wont have any side effect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like true
is the default for fetch
Web API itself in web environment.
src/web/index.ts
Outdated
|
||
constructor(configuration: PubNubConfiguration) { | ||
const configurationCopy = setDefaults(configuration); | ||
const platformConfiguration = { ...configurationCopy, sdkFamily: 'Nodejs', PubNubFile }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn’t it be ‘web’ instead of ‘Nodejs’
?
sdkFamily: 'Web'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh shoot, probably didn't save when fixed it once. Thank you for noticing!
Co-authored-by: Mohit Tejani <60129002+mohitpubnub@users.noreply.github.com>
…ub/javascript into feature/network-provider-interfaces
Bumped used NodeJS version to start from 18 because lower version EOL'ed.
Fix active request cancellation handling and proper abort handler reset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far Look good!
src/transport/web-transport.ts
Outdated
// type: 'module', | ||
// }, | ||
// ); | ||
this.worker = new Worker(WEB_WORKER_PLACEHOLDER, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
test: restore tests Fix tests runner and updated client inconsistency with previous behavior discovered by failing tests.
Callback and listener-based endpoints will catch exception and send it back as error status - this prevented from proper assertion reason propagation (issues reported as `done` call timeout instead).
…ub/javascript into feature/network-provider-interfaces
fix(fetch): disable `keepAlive` for browser transport `keepAlive` flag cause CORS issues with S3 bucket during file upload.
Fix issue because of which actual leave call not used. fix(event-engine): proper handling of cancelled requests Update code to use category instead of `Aborted` error message (which not valid anymore). test(contract): fix contract tests
Clean up internal Subscription Service Worker state from information about PubNub client which is not reachable through Service Worker Client (client with linked ID can't be fetched).
Fix issue with code import in `CommonJS` projects.
@@ -2,7 +2,7 @@ | |||
"$schema": "https://json.schemastore.org/tsconfig", | |||
"compilerOptions": { | |||
"target": "ES6", | |||
"module": "ES6", | |||
"module": "CommonJS", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
@pubnub-release-bot release as v8.0.0 |
🚀 Release successfully completed 🚀 |
this change suggests that the minimum browser versions supported may have been bumped to 2017. https://caniuse.com/fetch Does pubnub document anywhere what these minimums are? |
@k-funk The latest one, Safari, jumped on the train of modern techs, did it seven years ago, while others did it nine years ago. To keep compatibility with the most number of user environments, we deliberately didn't use the most advanced browser features. |
feat(network): replace
superagent
withfetch
Upgraded the network layer, replacing the
superagent
module with theFetch API
for browser integrations and node-fetch fornpm
integrations, ensuring enhanced performance and reliability.feat(service-worker): added service worker
Enhanced the subscribe feature with service worker support, improving user experience across multiple browser windows and tabs.
feat(types): client interface rewritten with TypeScript
The client interface rewritten with TypeScript, which gives an up-to-date interface.