Skip to content

Commit

Permalink
ds
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelSyntronic committed Mar 16, 2024
1 parent 225c293 commit df1d0ad
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions client/TurboBot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,29 @@ export class TurboBot {
isCheckingPool = false
})
this.onLogsSubscriptionId = subId

const ws = new WebSocket(config.rpcWsURL)
ws.onopen = () => {
ws.send(
JSON.stringify({
"jsonrpc": "2.0",
"id": "1",
"method": "slotSubscribe"
})
)

ws.onmessage = (evt) => {
try {
console.log(`New slot from WS: ${evt.data.toString()}`)
} catch (e) {
console.log(e)
}
}
}
ws.onerror = (e) => {
console.log(`WS error1: ${e.error.errors[0]}`)
console.log(`WS error2: ${e.error.errors[1]}`)
}
})
}

Expand Down

0 comments on commit df1d0ad

Please sign in to comment.