Coder Social home page Coder Social logo

daverin / flutter_client_sse Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pratikbaid3/flutter_client_sse

0.0 0.0 0.0 85 KB

Dart package to help consume SSE API. Consumes server sent events by returning parsed model of the event, id, and the data

Home Page: https://pub.dev/packages/flutter_client_sse

License: MIT License

Dart 100.00%

flutter_client_sse's Introduction

Flutter Client SSE

Dart package to help consume Server Sent Events

Features:

  • Consumes server sent events
  • Returns parsed model of the event, id and the data

Getting Started

Import

Add the following import in the pubspec.yaml file

client_sse:
    git:
      url: https://github.com/pratikbaid3/flutter_client_sse
      path:

Example

SSEClient.subscribeToSSE(
    url:
    'http://192.168.1.2:3000/api/activity-stream?historySnapshot=FIVE_MINUTE',
    header: {
    "Cookie":
    'jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJpYXQiOjE2NDMyMTAyMzEsImV4cCI6MTY0MzgxNTAzMX0.U0aCAM2fKE1OVnGFbgAU_UVBvNwOMMquvPY8QaLD138; Path=/; Expires=Wed, 02 Feb 2022 15:17:11 GMT; HttpOnly; SameSite=Strict',
    "Accept": "text/event-stream",
    "Cache-Control": "no-cache",
}).listen((event) {
    print('Id: ' + event.id!);
    print('Event: ' + event.event!);
    print('Data: ' + event.data!);
});

flutter_client_sse's People

Contributors

dariosiroki avatar daverin avatar foxb612 avatar gigi214 avatar pratikbaid3 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.