MCPcopy
hub / github.com/socketio/socket.io / isClientLockable

Function isClientLockable

packages/socket.io-cluster-engine/lib/engine.ts:113–132  ·  view source on GitHub ↗
(
  client: Socket,
  transportName: string,
  lockType: "read" | "write",
)

Source from the content-addressed store, hash-verified

111};
112
113function isClientLockable(
114 client: Socket,
115 transportName: string,
116 lockType: "read" | "write",
117) {
118 switch (transportName) {
119 case "polling":
120 return (
121 client.transport.name === "polling" &&
122 (lockType === "write" || !client.transport.writable)
123 );
124 case "websocket":
125 case "webtransport":
126 return (
127 client.transport.name === "polling" &&
128 !client.upgrading &&
129 !client.upgraded
130 );
131 }
132}
133
134function isValidSessionId(str: string) {
135 return typeof str === "string" && str.length === 20;

Callers 1

onMessageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected