2021-10-12
2211
#flutter
Gonçalo Palma
71489
Oct 12, 2021 ⋅ 7 min read

Using WebSockets in Flutter

Gonçalo Palma Lead Flutter Developer at PvotalTech, writer.

Recent posts:

react native's new architecture: sync and async rendering

React Native’s New Architecture: Sync and async rendering

React Native’s New Architecture offers significant performance advantages. In this article, you’ll explore synchronous and asynchronous rendering in React Native through practical use cases.

Emmanuel John
Dec 24, 2024 ⋅ 8 min read
Building a Full-Featured Laravel Admin Dashboard with Filament

Building a full-featured Laravel admin dashboard with Filament

Build scalable admin dashboards with Filament and Laravel using Form Builder, Notifications, and Actions for clean, interactive panels.

Kayode Adeniyi
Dec 20, 2024 ⋅ 5 min read
Working With URLs In JavaScript

Working with URLs in JavaScript

Break down the parts of a URL and explore APIs for working with them in JavaScript, parsing them, building query strings, checking their validity, etc.

Joe Attardi
Dec 19, 2024 ⋅ 6 min read
Lazy Loading Vs. Eager Loading

Lazy loading vs. Eager loading

In this guide, explore lazy loading and error loading as two techniques for fetching data in React apps.

Njong Emy
Dec 18, 2024 ⋅ 5 min read
View all posts

4 Replies to "Using WebSockets in Flutter"

  1. Very intuitive. Would love to see an implementation with State management packages such as Flutter Bloc or Riverpod.

  2. i am getting error my url start from https:// but getting error
    XCEPTION CAUGHT BY WIDGETS LIBRARY
    I/flutter ( 7839): The following WebSocketException was thrown building MyApp(dirty):
    I/flutter ( 7839): Unsupported URL scheme ‘https’
    why my api giving me data on every 5 second
    this is my code
    final channel = WebSocketChannel.connect(Uri.parse(BASE_URL));
    print(channel.closeReason);

    channel.stream.listen((message) {
    final questionData = message;
    print(‘question message–> $questionData’);

    // Handle the received question as needed
    // For example, you can add it to a list of questions or display it in the UI
    }, onError: (error) {
    // Handle WebSocket error
    print(error.toString());
    });

Leave a Reply