Skip to content

Commit

Permalink
fix: add websocket support
Browse files Browse the repository at this point in the history
  • Loading branch information
helius-wedtm committed Mar 5, 2023
1 parent 16abbf6 commit c6477fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
*.log

/dist

test.js
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ export default {
headers: corsHeaders,
});
}

const upgradeHeader = request.headers.get('Upgrade')
if (upgradeHeader || upgradeHeader === 'websocket') {
return await fetch(`https://rpc.helius.xyz/?api-key=${env.HELIUS_API_KEY}`, request)
}


const payload = await request.text();
Expand Down

0 comments on commit c6477fd

Please sign in to comment.