Skip to content

Commit

Permalink
Added logging to the WebSocket proxy in the API application
Browse files Browse the repository at this point in the history
  • Loading branch information
ihor committed Jun 7, 2024
1 parent 7bdb7ad commit 345aacf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions server/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,27 @@ async function main() {
target: config.csprCloudStreamingUrl,
ws: true,
changeOrigin: true,
logLevel: 'debug',
headers: {
authorization: config.csprCloudAccessKey,
},
on: {
proxyReqWs: (proxyReq) => {
console.log('WebSocket connection requestWS', res);
proxyReq.removeHeader('Origin');
},
proxyReq: (proxyReq, req, res) => {
console.log('WebSocket connection request', req.url)
},
open: (proxySocket) => {
console.log('WebSocket connection opened');
},
close: (res, socket, head) => {
console.log('WebSocket connection closed', res);
},
onError(err, req, res, target) {
console.log('WebSocket connection error', err);
}
}
});
app.get('/deploys', csprCloudStreamingProxy);
Expand Down

0 comments on commit 345aacf

Please sign in to comment.