diff --git a/client/src/context/Data.tsx b/client/src/context/Data.tsx index 1020b9df..9ac0b127 100644 --- a/client/src/context/Data.tsx +++ b/client/src/context/Data.tsx @@ -412,12 +412,11 @@ export const DataProvider = (props: { children: React.ReactNode }) => { const extraHeaders = { 'milvus-client-id': clientId, - 'x-attu-database': authReq.database, }; - socket.current = isElectron - ? io(url as string, { extraHeaders }) - : io({ extraHeaders }); + const ioParams = { extraHeaders, query: extraHeaders }; + + socket.current = isElectron ? io(url as string, ioParams) : io(ioParams); socket.current.on('connect', async () => { // console.info('--- ws connected ---', clientId); diff --git a/server/src/socket.ts b/server/src/socket.ts index aa5aeb9f..dd0e0252 100644 --- a/server/src/socket.ts +++ b/server/src/socket.ts @@ -16,7 +16,7 @@ export function initWebSocket(server: http.Server) { }); io.on('connection', (socket: Socket) => { - const clientId = socket.handshake.headers['milvus-client-id'] as string; + const clientId = socket.handshake.query['milvus-client-id'] as string; if (clientId) { clients.set(clientId, socket);