'Problems when receiving websocket data(it's json but result is list of number)
I am a beginner developer developing with Dart. There was a problem while working with websockets.
According to the API help, it's obviously JSON. but data is list of number :(
Why does it work this way?
I'll attach my code and results please help :(
I'm sorry I'm not good at English, I hope you understand
--------------code--------------------------------
import 'dart:convert';
import 'package:web_socket_channel/web_socket_channel.dart';
void main() async {
/// Create the WebSocket channel
final channel = WebSocketChannel.connect(
Uri.parse('wss://api.upbit.com/websocket/v1'),
);
channel.sink.add(jsonEncode([{"ticket":"test"},{"type":"ticker","codes":["KRW-BTC"]},{"format":"SIMPLE"}])
);
/// Listen for all incoming data
channel.stream.listen(
(data) {
print(data);
},
onError: (error) => print(error),
);
}
ouput flutter: [123, 34, 116, 121, 34, 58, 34, 116, 105, 99, 107, 101, 114, 34, 44, 34, 99, 100, 34, 58, 34, 75, 82, 87, 45, 66, 84, 67, 34......]
expected {"mk":"KRW-BTC","tms":1523531768829,"td":"2018-04-12","ttm":"11:16:03","ttms":1523531763000,"tp":7691000.0,"tv":0.00996719,"ab":"BID","pcp":7429000.00000000,"c":"RISE","cp":262000.00000000,"sid":1523531768829000,"st":"SNAPSHOT"}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
