Socket
Socket
Sign inDemoInstall

@trpc/client

Package Overview
Dependencies
Maintainers
3
Versions
1030
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trpc/client - npm Package Compare versions

Comparing version 11.0.0-rc.530 to 11.0.0-rc.531

36

dist/bundle-analysis.json
{
"bundleSize": 54079,
"bundleOrigSize": 71745,
"bundleReduction": 24.62,
"bundleSize": 54230,
"bundleOrigSize": 71834,
"bundleReduction": 24.51,
"modules": [
{
"id": "/src/links/wsLink.ts",
"size": 15128,
"origSize": 16913,
"size": 15279,
"origSize": 17002,
"renderedExports": [

@@ -16,4 +16,4 @@ "createWSClient",

"dependents": [],
"percent": 27.97,
"reduction": 10.55
"percent": 28.17,
"reduction": 10.13
},

@@ -29,3 +29,3 @@ {

"dependents": [],
"percent": 10.84,
"percent": 10.81,
"reduction": 3.51

@@ -42,3 +42,3 @@ },

"dependents": [],
"percent": 10.09,
"percent": 10.06,
"reduction": 18.48

@@ -67,3 +67,3 @@ },

],
"percent": 8.26,
"percent": 8.23,
"reduction": 32.82

@@ -83,3 +83,3 @@ },

],
"percent": 7.55,
"percent": 7.53,
"reduction": 5.64

@@ -96,3 +96,3 @@ },

"dependents": [],
"percent": 7.26,
"percent": 7.24,
"reduction": 4.69

@@ -109,3 +109,3 @@ },

"dependents": [],
"percent": 7.04,
"percent": 7.02,
"reduction": 9.86

@@ -122,3 +122,3 @@ },

"dependents": [],
"percent": 5.89,
"percent": 5.87,
"reduction": 14.15

@@ -138,3 +138,3 @@ },

],
"percent": 4,
"percent": 3.99,
"reduction": 47.6

@@ -159,3 +159,3 @@ },

],
"percent": 3.59,
"percent": 3.58,
"reduction": 45.43

@@ -192,3 +192,3 @@ },

],
"percent": 1.28,
"percent": 1.27,
"reduction": 32.75

@@ -205,3 +205,3 @@ },

"dependents": [],
"percent": 1.13,
"percent": 1.12,
"reduction": 44.95

@@ -208,0 +208,0 @@ },

@@ -123,4 +123,4 @@ 'use strict';

function createConnection() {
let pingTimeout;
let pongTimeout;
let pingTimeout = undefined;
let pongTimeout = undefined;
const self = {

@@ -197,18 +197,20 @@ id: ++connectionIndex,

const { pongTimeoutMs =1000 , intervalMs =5000 } = opts.keepAlive;
function sendPing() {
ws.send('PING');
pongTimeout = setTimeout(()=>{
ws.close(3001);
onClose(3001);
}, pongTimeoutMs);
const onMessage = (msg)=>{
if (msg.data === 'PONG') {
clearTimeout(pongTimeout);
pingTimeout = setTimeout(sendPing, intervalMs);
}
ws.removeEventListener('message', onMessage);
const schedulePing = ()=>{
const schedulePongTimeout = ()=>{
pongTimeout = setTimeout(()=>{
ws.close(3001);
onClose(3001);
}, pongTimeoutMs);
};
ws.addEventListener('message', onMessage);
}
pingTimeout = setTimeout(sendPing, intervalMs);
pingTimeout = setTimeout(()=>{
ws.send('PING');
schedulePongTimeout();
}, intervalMs);
};
ws.addEventListener('message', ()=>{
clearTimeout(pingTimeout);
clearTimeout(pongTimeout);
schedulePing();
});
schedulePing();
}

@@ -219,4 +221,4 @@ run(async ()=>{

}
handleKeepAlive();
await sendConnectionParams();
handleKeepAlive();
connectAttempt = 0;

@@ -273,2 +275,6 @@ self.state = 'open';

}
if (data === 'PING') {
ws.send('PONG');
return;
}
startLazyDisconnectTimer();

@@ -275,0 +281,0 @@ const msg = JSON.parse(data);

{
"name": "@trpc/client",
"version": "11.0.0-rc.530+d1e8f33f6",
"version": "11.0.0-rc.531+42d5af1b1",
"description": "The tRPC client library",

@@ -79,6 +79,6 @@ "author": "KATT",

"peerDependencies": {
"@trpc/server": "11.0.0-rc.530+d1e8f33f6"
"@trpc/server": "11.0.0-rc.531+42d5af1b1"
},
"devDependencies": {
"@trpc/server": "11.0.0-rc.530+d1e8f33f6",
"@trpc/server": "11.0.0-rc.531+42d5af1b1",
"@types/isomorphic-fetch": "^0.0.39",

@@ -100,3 +100,3 @@ "@types/node": "^20.10.0",

],
"gitHead": "d1e8f33f6bc6104003f4a0d4030c6cf306e6dec2"
"gitHead": "42d5af1b189a1b80b1f128deb81550b1ddc6eeb6"
}

@@ -266,4 +266,4 @@ import type { Observer, UnsubscribeFn } from '@trpc/server/observable';

function createConnection(): Connection {
let pingTimeout: ReturnType<typeof setTimeout> | undefined;
let pongTimeout: ReturnType<typeof setTimeout> | undefined;
let pingTimeout: ReturnType<typeof setTimeout> | undefined = undefined;
let pongTimeout: ReturnType<typeof setTimeout> | undefined = undefined;
const self: Connection = {

@@ -357,18 +357,21 @@ id: ++connectionIndex,

function sendPing() {
ws.send('PING');
pongTimeout = setTimeout(() => {
ws.close(3001);
onClose(3001);
}, pongTimeoutMs);
const onMessage = (msg: MessageEvent) => {
if (msg.data === 'PONG') {
clearTimeout(pongTimeout);
pingTimeout = setTimeout(sendPing, intervalMs);
}
ws.removeEventListener('message', onMessage);
const schedulePing = () => {
const schedulePongTimeout = () => {
pongTimeout = setTimeout(() => {
ws.close(3001);
onClose(3001);
}, pongTimeoutMs);
};
ws.addEventListener('message', onMessage);
}
pingTimeout = setTimeout(sendPing, intervalMs);
pingTimeout = setTimeout(() => {
ws.send('PING');
schedulePongTimeout();
}, intervalMs);
};
ws.addEventListener('message', () => {
clearTimeout(pingTimeout);
clearTimeout(pongTimeout);
schedulePing();
});
schedulePing();
}

@@ -380,7 +383,6 @@ run(async () => {

}
handleKeepAlive();
await sendConnectionParams();
handleKeepAlive();
connectAttempt = 0;

@@ -453,2 +455,6 @@ self.state = 'open';

}
if (data === 'PING') {
ws.send('PONG');
return;
}
startLazyDisconnectTimer();

@@ -455,0 +461,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc