Comments (2)
The "coinbase-pro-node" library was developed to run in a Node.js environment. However, it is possible to use the package in a browser environment (where Vue.js frontend apps are running) but you have to be aware of some consequences:
- REST calls are likely to be blocked by the browser's CORS policy, so you have to start your browser with disabled web security or use a proxy (i.e. webpack's dev server proxy) to communicate with Coinbase Pro's backend.
- WebSocket connections are established using the "ws" package (Node.js), but the browser comes with a native WebSocket implementation, so the constructor passed to
ReconnectingWebSocket
must be changed (Example).
Are you just having problems with establishing a WebSocket connection or do REST calls also fail for you?
from coinbase-pro-node.
Thank you for the update. I was able to get this working using the link that you sent.
async coinbaseRealtime() {
this.ws = new ReconnectingWebSocket(
'wss://ws-feed.pro.coinbase.com',
[],
{
key: '',
passphrase: '',
signature: '',
timestamp: Date.now() / 1000
}
)
this.ws.addEventListener('error', (e) => {
console.debug('error', e)
})
this.ws.addEventListener('open', () => {
console.debug('Connection open')
const subscribe = {
"type": 'subscribe',
"channels": [
{
"name": 'ticker',
"product_ids": ['BTC-USD', 'ETH-USD', 'LTC-USD']
}
]
}
this.ws.send(JSON.stringify(subscribe))
})
this.ws.addEventListener('message', (data) => {
console.debug('Received message', data)
})
}
from coinbase-pro-node.
Related Issues (20)
- Can't figure out this 400 Error HOT 3
- Thanks! HOT 4
- Websocket example implementation needs to be updated? HOT 2
- Sorry newb here and at my wits end
- Should ws.subscribe() be marked async and await sendMessage()? HOT 2
- Having trouble accessing listCoinBaseAccounts() HOT 10
- Support conversion (USDC -> USD)
- wrong candlesticks data HOT 3
- Portfolio commission
- Maybe update docs for passing channels? HOT 1
- Add ability to generate wallet addresses HOT 2
- Q: onopen does not trigger for authenticated socket in container HOT 2
- Fix code scanning alert - Polynomial regular expression used on uncontrolled data HOT 1
- granularity for websockets HOT 1
- Unable to recreate order book with l2 data
- Coinbase Advanced Trade API support
- Wallet Endpoint - AvailableBalance interface HOT 2
- Is getPaymentMethods() typing broken? (PaymentMethod Interface) HOT 7
- Is TransferInformation Interface Incorrect? HOT 2
- Coinbase Pro doesn't exist (tutorial) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coinbase-pro-node.