Viewing version 1.4.0. Open the latest package page.

sockjs_client_wrapper

1.4.0

A Dart wrapper for the `sockjs-client` JS library.

Download archive

Readme

SockJS Client Wrapper

A Dart wrapper around the SockJS Client. Uses the js Dart package to interop with the JS lib. The JS lib is vendored at lib/sockjs.js. The vendored lib is of sockjs-client v1.6.1 with one modification: the client does not make a /info request when establishing the connection.

Usage

Include the SockJS library in your app's index.html prior to the main Dart/JS script:

<!DOCTYPE html>
<html>
  <head> ... </head>
  <body>
    <!-- For local dev/debugging, use the unminified version: -->
    <script src="/packages/sockjs_client_wrapper/sockjs.js"></script>

    <!-- In production, use the minified version:  -->
    <script src="/packages/sockjs_client_wrapper/sockjs_prod.js"></script>
  </body>
</html>

Import package:sockjs_client_wrapper/sockjs_client_wrapper.dart and create a SockJSClient instance that will connect to a SockJS server:

import 'package:sockjs_client_wrapper/sockjs_client_wrapper.dart';

Future<Null> main() async {
  final client = new SockJSClient(Uri.parse('ws://localhost:9000/echo'));
  await client.onOpen.first;
  client.send('Hello!');
  ...
}

Development

Install dependencies

$ npm install
$ dart pub get

Run the example

$ dart run dart_dev serve

Run tests

$ dart run dart_dev test
Changelog

1.3.0

  • Add debugUrl field to SockJSOpenEvent, which will be set to the full SockJS URL connected to by the underlying transport when using the unminified sockjs.js asset.

1.2.0

  • Migrate to null safety. SDK constraint raised to 2.12

1.1.12

  • Update SockJS library to 1.6.1.

1.1.9

  • CI tweaks.

1.1.8

  • Dependency upgrades.
  • Simplify Github CI workflow.
  • Formatting and analysis lints.

1.1.6

  • Replace deprecated pub commands

1.1.4 - 1.1.5

  • Dependency upgrades.

1.1.0

  • Update SockJS library to 1.5.0 and add sourcemaps.

1.0.14

  • Raise Dart SDK minimum to 2.4.0

1.06 - 1.0.13

  • Internal changes and CI updates.

1.0.5

  • Dart 2 compatible.

1.0.4

  • Updated the SockJS library to v1.1.5 to pull in a fix for an issue where xhr_streaming loops infinitely after the connection closes.

1.0.3

  • Compatible with latest Dart 2.x dev channel and Dart Dev Compiler.

1.0.2

  • Logging was disabled as it was originally too verbose.

1.0.1

  • Add a version check to CI.

1.0.0

  • Initial release.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add 'sockjs_client_wrapper:1.4.0'
pubspec.yaml
name: sockjs_client_wrapper
version: 1.4.0
description: A Dart wrapper for the `sockjs-client` JS library.
homepage: https://github.com/Workiva/sockjs_client_wrapper

environment:
  sdk: '>=2.12.0 <3.0.0'

dependencies:
  js: ^0.6.1
  w_common: '>=2.0.0 <4.0.0'

dev_dependencies:
  build_runner: ^2.1.2
  build_test: ^2.1.3
  build_web_compilers: '>=3.0.0 <5.0.0'
  dart_dev: '>=3.6.5 <5.0.0'
  dependency_validator: ^3.2.0
  test: ^1.15.7
  workiva_analysis_options: ^1.3.0

Version history

VersionPublishedArchiveSHA-256
0.0.0Cached · Upstream SHA-256 matchedDownloadc70e75a9…986629
1.0.1Cached · Upstream SHA-256 matchedDownload95466024…032d5a
1.0.2Cached · Upstream SHA-256 matchedDownload7c50fdde…6389ae
1.0.3Cached · Upstream SHA-256 matchedDownload152626c7…92031f
1.0.4Cached · Upstream SHA-256 matchedDownload99a39595…c455b5
1.0.5Cached · Upstream SHA-256 matchedDownloadcff60f08…13a614
1.0.7Cached · Upstream SHA-256 matchedDownload5e93cdb8…64e507
1.0.8Cached · Upstream SHA-256 matchedDownload9363bb25…a5ec95
1.0.9Cached · Upstream SHA-256 matchedDownload0e106bb5…39c176
1.0.10Cached · Upstream SHA-256 matchedDownload684d9825…638b86
1.0.11Cached · Upstream SHA-256 matchedDownload513cb297…e286d9
1.0.14Cached · Upstream SHA-256 matchedDownload164d523b…3968ec
1.1.0Cached · Upstream SHA-256 matchedDownload6649993f…0b7d53
1.1.1Cached · Upstream SHA-256 matchedDownloadb6c02919…3589eb
1.1.2Cached · Upstream SHA-256 matchedDownload47dc3039…289233
1.1.3Cached · Upstream SHA-256 matchedDownload4972f92e…dc667c
1.1.4Cached · Upstream SHA-256 matchedDownload67c6ac08…fca1ab
1.1.5Cached · Upstream SHA-256 matchedDownload59e284fb…9aa032
1.1.8Cached · Upstream SHA-256 matchedDownload5cbcb0bd…94b5e0
1.1.12Cached · Upstream SHA-256 matchedDownloade6e57e39…f6a543
1.2.0Cached · Upstream SHA-256 matchedDownloadc304e85f…917054
1.3.0Cached · Upstream SHA-256 matchedDownloadb050d453…492937
1.4.0Cached · Upstream SHA-256 matchedDownload179c6d20…620e36
1.4.1Cached · Upstream SHA-256 matchedDownloada55be049…e94089
1.5.0Cached · Upstream SHA-256 matchedDownload2202c5cf…5dd6c0

Dependencies

js "^0.6.1"

w_common "\u003e=2.0.0 \u003c4.0.0"