# sockjs_client_wrapper 1.4.0

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




## Installing
```
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add 'sockjs_client_wrapper:1.4.0'
```
Published: 2025-05-15T20:54:39.328369Z
Expected archive SHA-256: 179c6d20ba316312abbd818675ff18af161c32643f2dea6c060abc4ef2620e36

Available in cache; verification: upstream_checksum
## Direct dependencies
- js: ^0.6.1
- w_common: >=2.0.0 <4.0.0

## Package README (untrusted upstream documentation)
# SockJS Client Wrapper

A Dart wrapper around the [SockJS Client][sockjs-client]. Uses the [`js` Dart package][js-dart-package] to interop with the JS lib. The JS lib is vendored at [`lib/sockjs.js`](./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:

```html
<!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:

```dart
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

```bash
$ npm install
$ dart pub get
```

### Run the example

```bash
$ dart run dart_dev serve
```

### Run tests

```bash
$ dart run dart_dev test
```

[js-dart-package]: https://pub.dartlang.org/packages/js
[sockjs-client]: https://github.com/sockjs/sockjs-client

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







 
