shelf_web_socket 0.2.2+4

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 97

Web Socket Handler for Shelf

shelf_web_socket is a Shelf handler for establishing WebSocket connections. It exposes a single function, webSocketHandler, which calls an onConnection callback with a CompatibleWebSocket object for every connection that's established.

import 'package:shelf/shelf_io.dart' as shelf_io;
import 'package:shelf_web_socket/shelf_web_socket.dart';

void main() {
  var handler = webSocketHandler((webSocket) {
    webSocket.listen((message) {
      webSocket.add("echo $message");
    });
  });

  shelf_io.serve(handler, 'localhost', 8080).then((server) {
    print('Serving at ws://${server.address.host}:${server.port}');
  });
}

0.2.2+4

  • Fix the check for onConnection to check the number of arguments and not that the arguments are dynamic.

0.2.2+3

  • Set max SDK version to <3.0.0, and adjust other dependencies.

0.2.2+2

  • Stopped using deprected HTML_ESCAPE constant name.

0.2.2+1

  • Update SDK version to 2.0.0-dev.17.0.

0.2.2

  • Stop using comment-based generic syntax.

0.2.1

  • Fix all strong-mode warnings.

0.2.0

  • Breaking change: webSocketHandler() now uses the WebSocketChannel class defined in the web_socket_channel package, rather than the deprecated class defined in http_parser.

0.1.0

  • Breaking change: webSocketHandler() now passes a WebSocketChannel to the onConnection() callback, rather than a deprecated CompatibleWebSocket.

0.0.1+5

  • Support http_parser 2.0.0.

0.0.1+4

  • Fix a link to shelf in the README.

0.0.1+3

  • Support http_parser 1.0.0.

0.0.1+2

  • Mark as compatible with version 0.6.0 of shelf.

0.0.1+1

  • Properly parse the Connection header. This fixes an issue where Firefox was unable to connect.

Use this package as a library

1. Depend on it

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


dependencies:
  shelf_web_socket: ^0.2.2+4

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:shelf_web_socket/shelf_web_socket.dart';
  
Version Uploaded Documentation Archive
0.2.2+4 Aug 6, 2018 Go to the documentation of shelf_web_socket 0.2.2+4 Download shelf_web_socket 0.2.2+4 archive
0.2.2+3 Jul 18, 2018 Go to the documentation of shelf_web_socket 0.2.2+3 Download shelf_web_socket 0.2.2+3 archive
0.2.2+2 Jun 1, 2018 Go to the documentation of shelf_web_socket 0.2.2+2 Download shelf_web_socket 0.2.2+2 archive
0.2.2+1 May 15, 2018 Go to the documentation of shelf_web_socket 0.2.2+1 Download shelf_web_socket 0.2.2+1 archive
0.2.2 Sep 27, 2017 Go to the documentation of shelf_web_socket 0.2.2 Download shelf_web_socket 0.2.2 archive
0.2.1 May 11, 2016 Go to the documentation of shelf_web_socket 0.2.1 Download shelf_web_socket 0.2.1 archive
0.2.0 Mar 3, 2016 Go to the documentation of shelf_web_socket 0.2.0 Download shelf_web_socket 0.2.0 archive
0.1.0 Feb 1, 2016 Go to the documentation of shelf_web_socket 0.1.0 Download shelf_web_socket 0.1.0 archive
0.0.1+5 Dec 14, 2015 Go to the documentation of shelf_web_socket 0.0.1+5 Download shelf_web_socket 0.0.1+5 archive
0.0.1+4 Aug 27, 2015 Go to the documentation of shelf_web_socket 0.0.1+4 Download shelf_web_socket 0.0.1+4 archive

All 14 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
95
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]
97
Learn more about scoring.

We analyzed this package on Aug 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.11.8

Platforms

Detected platforms: Flutter, other

Primary library: package:shelf_web_socket/shelf_web_socket.dart with components: isolate.

Suggestions

The description is too short.

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Package is pre-v1 release.

While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction of the API.

Maintain an example.

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use shelf_web_socket.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.17.0 <3.0.0
shelf >=0.7.0 <0.8.0 0.7.3+3
stream_channel ^1.4.0 1.6.8
web_socket_channel ^1.0.0 1.0.9
Transitive dependencies
async 2.0.8
charcode 1.1.2
collection 1.14.11
convert 2.0.2
crypto 2.0.6
http_parser 3.1.3
path 1.6.2
source_span 1.4.1
stack_trace 1.9.3
string_scanner 1.0.3
typed_data 1.1.6
Dev dependencies
http >=0.10.0 <0.12.0
test >=0.12.42 <2.0.0