Viewing version 0.0.1+1. Open the latest package page.

shelf_web_socket

0.0.1+1

A WebSocket handler for Shelf.

Download archive

Readme

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}');
  });
}
Changelog

0.0.1+1

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

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add 'shelf_web_socket:0.0.1+1'
pubspec.yaml
name: shelf_web_socket
version: 0.0.1+1
author: "Dart Team <misc@dartlang.org>"
homepage: http://www.dartlang.org
description: >
  A WebSocket handler for Shelf.
dependencies:
  http_parser: ">=0.0.2 <0.1.0"
  shelf: ">=0.5.2 <0.6.0"
dev_dependencies:
  http: ">=0.10.0 <0.12.0"
  unittest: ">=0.10.0 <0.12.0"
environment:
  sdk: ">=1.4.0-dev.5.0 <2.0.0"

Version history

VersionPublishedArchiveSHA-256
0.0.1Cached · Upstream SHA-256 matchedDownload58ff7d45…455f32
0.0.1+1Cached · Upstream SHA-256 matchedDownloadad48f05a…a3078a
0.0.1+2Cached · Upstream SHA-256 matchedDownload42fdfbe2…d2b99d
0.0.1+3Cached · Upstream SHA-256 matchedDownload7892a400…ecc5de
0.0.1+4Cached · Upstream SHA-256 matchedDownloadf2a7cea6…142ff4
0.0.1+5Cached · Upstream SHA-256 matchedDownloadd05f869b…960662
0.1.0Cached · Upstream SHA-256 matchedDownload4821e5f2…d89e47
0.2.0Cached · Upstream SHA-256 matchedDownload8c4b140a…ec4407
0.2.1Cached · Upstream SHA-256 matchedDownload48e26601…3fa357
0.2.2Cached · Upstream SHA-256 matchedDownloade0ac3cb8…f3c63e
0.2.2+1Cached · Upstream SHA-256 matchedDownloadbeed8315…cfe822
0.2.2+2Cached · Upstream SHA-256 matchedDownloade8d07a73…53d2a3
0.2.2+3Cached · Upstream SHA-256 matchedDownload79bcc3cd…a8cedf
0.2.2+4Cached · Upstream SHA-256 matchedDownload2a56a104…e418cf
0.2.2+5Cached · Upstream SHA-256 matchedDownload5a6c9bb7…3b27d9
0.2.3Cached · Upstream SHA-256 matchedDownload31ff82cb…886ec7
0.2.4Cached · Upstream SHA-256 matchedDownloade20ec869…b7c5c2
0.2.4+1Cached · Upstream SHA-256 matchedDownload2a300f6d…1b20d1
1.0.0Cached · Upstream SHA-256 matchedDownload520368a1…ebc6fc
1.0.1Cached · Upstream SHA-256 matchedDownloadfd84910b…00332d
1.0.2Cached · Upstream SHA-256 matchedDownload6db16374…b08afc
1.0.3Cached · Upstream SHA-256 matchedDownloada988c0e8…7156e8
1.0.4Cached · Upstream SHA-256 matchedDownload9ca081be…7a84c1
2.0.0Cached · Upstream SHA-256 matchedDownload073c1472…4ac611
2.0.1Cached · Upstream SHA-256 matchedDownloadcc36c297…023b67
3.0.0Cached · Upstream SHA-256 matchedDownload3632775c…580925

Dependencies

http_parser "\u003e=0.0.2 \u003c0.1.0"

shelf "\u003e=0.5.2 \u003c0.6.0"