Skip to content

Commit

Permalink
client: cache bust engine io requests
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Oct 10, 2023
1 parent e49e13a commit 7f0f0cb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,13 @@ export async function connectScryptedClient(options: ScryptedClientOptions): Pro
let socket: IOClientSocket;
const eioPath = `endpoint/${pluginId}/engine.io/api`;
const eioEndpoint = baseUrl ? new URL(eioPath, baseUrl).pathname : '/' + eioPath;
// https://github.com/socketio/engine.io/issues/690
const cacehBust = Math.random().toString(36).substring(3, 10);
const eioOptions: Partial<SocketOptions> = {
path: eioEndpoint,
query: {
cacehBust,
},
withCredentials: true,
extraHeaders,
rejectUnauthorized: false,
Expand Down Expand Up @@ -439,6 +444,9 @@ export async function connectScryptedClient(options: ScryptedClientOptions): Pro
console.log('trying webrtc');
const webrtcEioOptions: Partial<SocketOptions> = {
path: '/endpoint/@scrypted/webrtc/engine.io/',
query: {
cacehBust,
},
withCredentials: true,
extraHeaders,
rejectUnauthorized: false,
Expand Down

0 comments on commit 7f0f0cb

Please sign in to comment.