Comments (1)
It is not a direct WebSocket API, it's is socket.io - a higher-level API which can use both polling and websockets.
Additionally this site has problems with subscribing to those events when using WebSocket part of socket.io exclusively. Try changing ('https://ws-api.iextrading.com/1.0/tops')
to ('https://ws-api.iextrading.com/1.0/tops', {transports: ["websocket"]})
and ('https://ws-api.iextrading.com/1.0/tops', {transports: ['polling',"websocket"]})
to see the difference.
Nevertheless it is still possible to use Websocat to subscribe to those events:
$ curl 'https://ws-api.iextrading.com/socket.io/?EIO=3&transport=polling' ; echo
97:0{"sid":"uW7mDLs5qLKXxGRKAAdv","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":60000}
$ curl -X POST -H "Content-Type: text/plain;charset=UTF-8" -d '12:40/1.0/tops,' 'https://ws-api.iextrading.com/socket.io/?EIO=3&transport=polling&sid=uW7mDLs5qLKXxGRKAAdv' ; echo
ok
$ websocat -E --linemode-strip-newlines 'wss://ws-api.iextrading.com/socket.io/?EIO=3&transport=websocket&sid=uW7mDLs5qLKXxGRKAAdv'
2probe
3probe
5
40
40/1.0/tops
42/1.0/tops,["subscribe", "fb"]
42/1.0/tops,["message","{\"symbol\":\"FB\",\"sector\":\"mediaentertainment\",\"securityType\":\"commonstock\",\"bidPrice\":138.0000,\"bidSize\":200,\"askPrice\":142.6400,\"askSize\":100,\"lastUpdated\":1542303584818,\"lastSalePrice\":142.5600,\"lastSaleSize\":100,\"lastSaleTime\":1542303578499,\"volume\":647393,\"marketPercent\":0.03941,\"seq\":220408}"]
42/1.0/tops,["message","{\"symbol\":\"FB\",\"sector\":\"mediaentertainment\",\"securityType\":\"commonstock\",\"bidPrice\":142.5800,\"bidSize\":100,\"askPrice\":142.6400,\"askSize\":100,\"lastUpdated\":1542303584819,\"lastSalePrice\":142.5600,\"lastSaleSize\":100,\"lastSaleTime\":1542303578499,\"volume\":647393,\"marketPercent\":0.03941,\"seq\":220409}"]
42/1.0/tops,["message","{\"symbol\":\"FB\",\"sector\":\"mediaentertainment\",\"securityType\":\"commonstock\",\"bidPrice\":138.0000,\"bidSize\":200,\"askPrice\":142.6400,\"askSize\":100,\"lastUpdated\":1542303584829,\"lastSalePrice\":142.5600,\"lastSaleSize\":100,\"lastSaleTime\":1542303578499,\"volume\":647393,\"marketPercent\":0.03941,\"seq\":220410}"]
42/1.0/tops,["message","{\"symbol\":\"FB\",\"sector\":\"mediaentertainment\",\"securityType\":\"commonstock\",\"bidPrice\":142.5800,\"bidSize\":100,\"askPrice\":142.6400,\"askSize\":100,\"lastUpdated\":1542303584899,\"lastSalePrice\":142.5600,\"lastSaleSize\":100,\"lastSaleTime\":1542303578499,\"volume\":647393,\"marketPercent\":0.03941,\"seq\":220411}"]
42/1.0/tops,["message","{\"symbol\":\"FB\",\"sector\":\"mediaentertainment\",\"securityType\":\"commonstock\",\"bidPrice\":138.0000,\"bidSize\":200,\"askPrice\":142.6400,\"askSize\":100,\"lastUpdated\":1542303584917,\"lastSalePrice\":142.5600,\"lastSaleSize\":100,\"lastSaleTime\":1542303578499,\"volume\":647393,\"marketPercent\":0.03941,\"seq\":220412}"]
42/1.0/tops,["message","{\"symbol\":\"FB\",\"sector\":\"mediaentertainment\",\"securityType\":\"commonstock\",\"bidPrice\":142.5700,\"bidSize\":100,\"askPrice\":142.6400,\"askSize\":100,\"lastUpdated\":1542303585024,\"lastSalePrice\":142.5600,\"lastSaleSize\":100,\"lastSaleTime\":1542303578499,\"volume\":647393,\"marketPercent\":0.03941,\"seq\":220413}"]
...
You type 2probe
, 5
and 42/1.0/tops,["subscribe", "fb"]
into Websocat and observe 3probe
, 40
, 40/1.0/tops,
and 42/1.0/tops,["message",...]
from it.
Future versions of Websocat may support socket.io more directly (although working without initial polling phase will be required). Example of simpler socket.io session using Websocat exclusively can be found here: https://stackoverflow.com/a/51190789/266720
from websocat.
Related Issues (20)
- What do I do with the file? Say 'websocat.aarch64-unknown-linux-musl' I downloaded, now what? HOT 2
- Executable no longer statically linked HOT 3
- unable to run external commands in background or from crontab HOT 9
- what is the value of "--just-generate-accept" HOT 4
- `let res = stage1.custom_headers(&h);` got block HOT 6
- provide interface that accepts `Opts` and `std::process::Stdio` HOT 3
- Binary response frames are not handled well HOT 5
- Binary Frames support HOT 8
- websocat.x86_64-unknown-linux-musl on Ubuntu is seems to end before a message is received? HOT 4
- Specify server TLS certificate HOT 2
- "dropped a ping request from websocket due to channel contention" HOT 2
- Specify TLS hostname separately from connect hostname HOT 2
- Refersh header while interractive session is in progress HOT 15
- Question: how do websocat know the other one reached EOF ?
- How do websocat know the other one reached EOF ? HOT 3
- Print more details on I/O failure
- websocat does not report errors when the connection dies HOT 1
- Is there any way to print plain text of request and response when connecting to wss endpoint ? HOT 1
- Pkcs12 compatibility issues on OpenSSL 1.x.x HOT 5
- Consider allowing basic auth to be passed in environment variable to hide it from the rest of users HOT 4
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 websocat.