FLUTTER ECOSYSTEM

Workiva/sockjs_client_wrapper

SockJS 客戶端的 Dart 包裝器。使用 js Dart 包與 JS 庫進行互操作。

sockjs_client_wrapper 專案封面
Stars
2
Forks
11
最近推送(UTC)
2026年7月31日
專案狀態
未封存
Workiva GitHub avatar
GITHUB Organization

Workiva ↗

語言JavaScriptDartHTML

此儲存庫發佈的套件

使用的依賴

依賴清單 9 項

原始 README

以下為英文專案原文快照,最新內容請造訪 GitHub。

展開 / 收合專案 README

SockJS Client Wrapper

A Dart wrapper around the SockJS Client. Uses the js Dart package to interop with the JS lib.

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