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

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);
    kiteTicker.addDataListener('home', 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
140
pub points
53%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter, flutter_web_plugins, web_socket_channel

More

Packages that depend on kiteparser