Skip to content

Commit

Permalink
chore(apI): debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
JPBM135 committed May 4, 2023
1 parent d4db87e commit 0065007
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/api/src/routes/sub-routes/scan/WebsocketScan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function scanGetWebsocketHandler(req: Request, res: Response): Prom
const redis = container.resolve<Redis>(kRedis);

try {
logger.debug('Connection received', {
logger.debug('(GET) Connection received', {
ip: req.socket.remoteAddress,
});

Expand All @@ -44,10 +44,12 @@ export async function scanGetWebsocketHandler(req: Request, res: Response): Prom
throw new HttpError(HttpStatusCode.NotFound, 'NotFound', "Scan not found or can't be connected to");
}

logger.info(`Client connected to scan ${scan_id}`, {
logger.info(`(GET) Client connected to scan ${scan_id}`, {
ip: req.socket.remoteAddress,
});

console.log(req.headers);

wss.handleUpgrade(req, req.socket, Buffer.from(req.headers['sec-websocket-key'] as string, 'base64'), (ws) => {
wss.emit(`connection:${scan_id}`, ws, req);
});
Expand All @@ -60,7 +62,7 @@ export async function scanWebsocketHandler(ws: WebSocket, req: IncomingMessage):
const redis = container.resolve<Redis>(kRedis);

try {
logger.debug('Connection received', {
logger.debug('(WSS) Connection received', {
ip: req.socket.remoteAddress,
});

Expand All @@ -86,7 +88,7 @@ export async function scanWebsocketHandler(ws: WebSocket, req: IncomingMessage):

const server = container.resolve<WebSocketServer>(kWebSockets);

logger.info(`Client connected to scan ${scan_id}`, {
logger.info(`(WSS) Client connected to scan ${scan_id}`, {
ip: req.socket.remoteAddress,
});

Expand Down

0 comments on commit 0065007

Please sign in to comment.