signalr_core 1.0.2

Introduction #

ASP.NET Core SignalR is an open-source library that simplifies adding real-time web functionality to apps. Real-time web functionality enables server-side code to push content to clients instantly. It's platform-independent, and can be used on both the command-line and the browser.

Example #

final connection = HubConnectionBuilder().withUrl('http://localhost:5000/chatHub', 
    HttpConnectionOptions(
        logging: (level, message) => print(message),
    )).build();
 
await connection.start();

connection.on('ReceiveMessage', (message) {
    print(message.toString());
});

await connection.invoke('SendMessage', args: ['Bob', 'Says hi!']);

1.0.0 #

  • Initial version, created by Stagehand

1.0.1 #

  • Formatting and other updates.

example/main.dart

import 'package:signalr_core/signalr_core.dart';

main() async {
  final connection = HubConnectionBuilder()
      .withUrl(
          'http://localhost:5000/chatHub',
          HttpConnectionOptions(
            transport: HttpTransportType.webSockets,
            logging: (level, message) => print(message),
          ))
      .withAutomaticReconnect()
      .build();

  await connection.start();

  connection.on('ReceiveMessage', (message) {
    print(message.toString());
  });

  connection.onreconnecting((e) {
    print('Reconnecting yo');
  });

  await connection.invoke('SendMessage', args: ['Bob', 'Says hi!']);
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  signalr_core: ^1.0.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:signalr_core/signalr_core.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
66
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
83
Learn more about scoring.

We analyzed this package on Feb 12, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Health suggestions

Fix lib/src/hub_connection_builder.dart. (-0.50 points)

Analysis of lib/src/hub_connection_builder.dart reported 1 hint:

line 7 col 21: The value of the field '_httpTransportType' isn't used.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
http ^0.12.0+2 0.12.0+4
logging ^0.11.3+2 0.11.4
sse_client ^0.0.2 0.0.2
tuple ^1.0.3 1.0.3
web_socket_channel ^1.1.0 1.1.0
Transitive dependencies
async 2.4.0
charcode 1.1.3
collection 1.14.12
convert 2.1.1
crypto 2.1.4
http_parser 3.1.3
matcher 0.12.6
meta 1.1.8
path 1.6.4
quiver 2.1.2+1
source_span 1.6.0
stack_trace 1.9.3
stream_channel 2.0.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
pedantic ^1.8.0 1.9.0
test ^1.6.0