p-hatan/ mirror

pub repository

mirror.p-hatan.com

shelf_web_socket

0.0.1+4

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+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.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add shelf_web_socket
pubspec.yaml
name: shelf_web_socket
version: 0.0.1+4
author: "Dart Team <misc@dartlang.org>"
homepage: http://github.com/dart-lang/shelf_web_socket
description: >
  A WebSocket handler for Shelf.
dependencies:
  http_parser: ">=0.0.2 <2.0.0"
  shelf: ">=0.5.2 <0.7.0"
dev_dependencies:
  http: ">=0.10.0 <0.12.0"
  test: ">=0.12.0 <0.13.0"
environment:
  sdk: ">=1.4.0-dev.5.0 <2.0.0"

Version history

VersionPublishedArchiveSHA-256
0.0.12014-05-20T22:17:56.367510ZDownload58ff7d45a196f39e8c2d1bdce1282850c3e25acf2c0f0ea345f036f706455f32
0.0.1+12014-12-18T00:59:00.894170ZDownloadad48f05a9ac8a82e4734646fa2827eea28808dc93bfe2b4bcaa532d455a3078a
0.0.1+22015-03-05T01:41:24.788340ZDownload42fdfbe22c3757dde8a86a55db082c623578be87bfcedf133ff162cff0d2b99d
0.0.1+32015-08-26T20:31:49.579ZDownload7892a400a16f3251afc3a84e7967417f2a2699a9e6315229c95f04c4dcecc5de
0.0.1+42015-08-27T19:57:44.664ZDownloadf2a7cea615cb3b6340025fdbe9762b695812fb2e0dccb1d0e74362307b142ff4
0.0.1+52015-12-14T22:18:25.598ZDownloadd05f869b90c16d042d25da87b1d99840a4f50d8b211b6ad494090460a5960662
0.1.02016-02-01T19:52:14.349ZDownload4821e5f24f59f99a5f2d364771505d263388f0f66268df202f7f22d700d89e47
0.2.02016-03-03T20:08:48.961ZDownload8c4b140a4553fd68e9c6b82f18f4ce59dc04681454857a571a36a89a17ec4407
0.2.12016-05-11T23:04:31.642ZDownload48e26601ad549ed5bdcc52a90ec59597154e05722ede2e66e85d5221ac3fa357
0.2.22017-09-27T20:38:29.059807ZDownloade0ac3cb86b71869f711ec1eeed65db2cac01ea2ac19b6c79c7b10dda9ef3c63e
0.2.2+12018-05-15T20:21:07.316253ZDownloadbeed8315034d57ee7a4040d8a33a3ea9b140f87c78da955e5d818f3ff2cfe822
0.2.2+22018-06-01T16:20:27.397516ZDownloade8d07a732181f4c203aa7117c34170c3bc5059a253f9060211ebc65a8b53d2a3
0.2.2+32018-07-18T16:33:42.717487ZDownload79bcc3cdb1082122cda2ea67fd3ec8013efc0d4580d8601160be829beba8cedf
0.2.2+42018-08-06T19:43:01.184384ZDownload2a56a1040b8c3e1e8cd522b8c5a26cca3ebd107e72b0a4c877b8ba1f93e418cf
0.2.2+52019-03-27T19:05:07.428883ZDownload5a6c9bb79b8296ea2fc8bdae940e0e10b42c1356dc2564bea0a42f52403b27d9
0.2.32019-04-17T19:28:38.522410ZDownload31ff82cb8d68bc39a938fdced96b17ef7239c28151028b4d7e80ca027b886ec7
0.2.42021-01-29T16:17:41.396873ZDownloade20ec869a8d9cf33463ad914bd6344365187477ae8b63004d324d9a969b7c5c2
0.2.4+12021-02-18T22:03:13.682842ZDownload2a300f6dd3d4a6d41941eef97920671ecd250712ce1275bf60110997691b20d1
1.0.02021-02-24T18:20:39.156892ZDownload520368a1a49798425310ca0ee28eb92b3c737e4e9d173c31b6c66fe090ebc6fc
1.0.12021-03-17T19:54:14.464285ZDownloadfd84910bf7d58db109082edf7326b75322b8f186162028482f53dc892f00332d
1.0.22022-06-16T01:22:56.063100ZDownload6db16374bc3497d21aa0eebe674d3db9fdf82082aac0f04dc7b44e4af5b08afc
1.0.32022-11-03T20:04:08.567245ZDownloada988c0e8d8ffbdb8a28aa7ec8e449c260f3deb808781fe1284d22c5bba7156e8
1.0.42023-05-03T19:23:15.269304ZDownload9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1
2.0.02024-05-06T20:05:29.373825ZDownload073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611
2.0.12024-11-22T16:38:06.588921ZDownloadcc36c297b52866d203dbf9332263c94becc2fe0ceaa9681d07b6ef9807023b67
3.0.02025-01-30T17:50:10.363347ZDownload3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925

Dependencies

http_parser "\u003e=0.0.2 \u003c2.0.0"

shelf "\u003e=0.5.2 \u003c0.7.0"