Skip to content

Commit

Permalink
feat: remove websocket server
Browse files Browse the repository at this point in the history
  • Loading branch information
sephorah committed Sep 7, 2023
1 parent 71f4d0b commit 5272e09
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions pages/api/program/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const handlePush = async ({ octokit, payload }) => {
// Pipe the ReadableStream to the write stream using pipeline
await pipeline(response.data, writeStream);
console.log(`Repository ZIP archive downloaded and saved as ${payload.repository.name}.zip`);
sendPushNotification(`./${payload.repository.name}.zip`);
} catch (error) {
if (error.response) {
console.error(`Error! Status: ${error.response.status}. Message: ${error.response.data.message}`)
Expand Down Expand Up @@ -102,27 +101,4 @@ const server = http.createServer(async (req, res) => {
res.end();
})


const wsServer = new WebSocketServer({ server });

// server.on('upgrade', (request, socket, head) => {
// wsServer.handleUpgrade(request, socket, head, (ws: WebSocket) => {
// wsServer.emit('connection', ws, request);
// });
// });


const sendPushNotification = (filename:string) => {
console.log("wsserver", wsServer.clients);
wsServer.clients.forEach((client) => {
if (client.readyState === WebSocket.OPEN) {
client.send(filename);
console.log("sent\n");
}
});
}
wsServer.on('connection', function(connection) {
console.log("Connected\n")
});

server.listen(3030);

0 comments on commit 5272e09

Please sign in to comment.