Environment agnostic websocket api
npm install @ton-api/isomorphic-wsThis package provides WebSocket applicable in different environments (browser & NodeJS).
npm i @ton-api/isomorphic-wsWebSocket constructor:``ts
import '@ton-api/isomorphic-ws';
const webSocketInstance = new WebSocket();
`
That will work in both browser and NodeJS.
imported from the ws package to the global variable.Note that this package doesn't provide an
WebSocket polyfill for browsers which doesn't support WebSocket` natively.