Hello,
I am trying to use websockets to connect to a socket with a wss url to get live ticker updates on a currency pair.
the documentation says :
I am getting ws_connected on the logs but I can't find out how can i get the pushed stream.
documentation says I will get stg like this:
it is the first time i am working with websockets, I tried checking out this topic : https://www.b4x.com/android/forum/threads/jwebsocketclient-library.40985/
but the example client has 2 modules which i am not sure if i have to use or not. Can you point me to right direction to work.
Thanks
I am trying to use websockets to connect to a socket with a wss url to get live ticker updates on a currency pair.
the documentation says :
- The base endpoint is: wss://stream.binance.com:9443
- Streams can be access either in a single raw stream or a combined stream
- Raw streams are accessed at /ws/<streamName>
- Combined streams are accessed at /stream?streams=<streamName1>/<streamName2>/<streamName3>
- Combined stream events are wrapped as follows: {"stream":"<streamName>","data":<rawPayload>}
- All symbols for streams are lowercase
- A single connection to stream.binance.com is only valid for 24 hours; expect to be disconnected at the 24 hour mark
So I used :Individual Symbol Ticker Streams
24hr Ticker statistics for a single symbol pushed every second
Stream Name: <symbol>@ticker
Payload:
B4X:
ws.Initialize("ws")
ws.Connect("wss://stream.binance.com:9443/ws/BNBBTC@ticker")
I am getting ws_connected on the logs but I can't find out how can i get the pushed stream.
documentation says I will get stg like this:
B4X:
{
"e": "24hrTicker", // Event type
"E": 123456789, // Event time
"s": "BNBBTC", // Symbol
"p": "0.0015", // Price change
"P": "250.00", // Price change percent
"w": "0.0018", // Weighted average price
"x": "0.0009", // Previous day's close price
"c": "0.0025", // Current day's close price
"Q": "10", // Close trade's quantity
"b": "0.0024", // Best bid price
"B": "10", // Bid bid quantity
"a": "0.0026", // Best ask price
"A": "100", // Best ask quantity
"o": "0.0010", // Open price
"h": "0.0025", // High price
"l": "0.0010", // Low price
"v": "10000", // Total traded base asset volume
"q": "18", // Total traded quote asset volume
"O": 0, // Statistics open time
"C": 86400000, // Statistics close time
"F": 0, // First trade ID
"L": 18150, // Last trade Id
"n": 18151 // Total number of trades
}
it is the first time i am working with websockets, I tried checking out this topic : https://www.b4x.com/android/forum/threads/jwebsocketclient-library.40985/
but the example client has 2 modules which i am not sure if i have to use or not. Can you point me to right direction to work.
Thanks