kiteparser 0.0.1 copy "kiteparser: ^0.0.1" to clipboard
kiteparser: ^0.0.1 copied to clipboard

outdated

A Helper Utility for parsing the web socket from octet stream model

kiteparser #

This package is used to parse zerodha's kite websocket complex octet stream data to json model. It uses the kite APIs version v3. You can check more information about it here,kite-apis

Pre requirements #

Getting Started #

Add as dependency in pubspec.yaml file

dependencies:
  flutter:
    sdk: flutter
  kiteparser: ^0.0.1
import 'package:kiteparser/kite/kite_ticker.dart';
import 'package:web_socket_channel/io.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp>
    implements SocketConnectionListener, OnDataListener {
  final kiteTicker = KiteTicker();

  @override
  void initState() {
    super.initState();
    kiteTicker.setUpSocket(
        'your api key', 'your access token got from login', this);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Kite Websocket example'),
        ),
        body: const Center(
          child: Text(''),
        ),
      ),
    );
  }

  @override
  void onConnected(IOWebSocketChannel client) {
    ///Here you can subscribe any instruments
    ///
    client.sink.add(jsonEncode({
      "a": "subscribe",
      "v": [408065, 884737]
    }));
  }

  @override
  void onData(List<Tick> list) {
    print(list);
  }

  @override
  void onError(String error) {
    print(error);
  }
}
2
likes
0
points
160
downloads

Publisher

unverified uploader

Weekly Downloads

A Helper Utility for parsing the web socket from octet stream model

Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface, web_socket_channel

More

Packages that depend on kiteparser

Packages that implement kiteparser