https://github.com/stevenroose/dart-websockets
  
  
    A generic WebSocket package for Dart 
    https://github.com/stevenroose/dart-websockets
  
        Last synced: 8 months ago 
        JSON representation
    
A generic WebSocket package for Dart
- Host: GitHub
- URL: https://github.com/stevenroose/dart-websockets
- Owner: stevenroose
- License: mit
- Created: 2015-06-16T01:03:32.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-10-16T17:06:45.000Z (about 9 years ago)
- Last Synced: 2025-02-28T06:57:40.830Z (8 months ago)
- Language: Dart
- Homepage:
- Size: 43.9 KB
- Stars: 11
- Watchers: 3
- Forks: 3
- Open Issues: 4
- 
            Metadata Files:
            - Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
 
Awesome Lists containing this project
README
          # websockets
A platform-independent WebSocket library using the Dart async API.
This library defines a WebSocket interface very much like the one in `dart:io` that can be used when writing
platform-independent packages like API-wrappers.
## Documentation
The documentation for this library can be found [on DartDocs](https://www.dartdocs.org/documentation/websockets/0.2.1/).
## Usage
Creating and using WebSockets with this library is easy, it works entirely the same as how the dart:io.WebSocket
class works:
```dart
import "dart:io";
import "package:websockets/websockets.dart";
main() async {
  WebSocket ws = await WebSocket.connect("wss://echo.websocket.org");
  ws.listen(print);
  ws.add("test");
}
```
### When developing platform-independent packages
Everything stays the same. The websockets import does not import `dart:io` or `dart:html`, so your code will run
on both platforms. One thing to remember is that the user of your library has to make an explicit import of either of
`dart:io` or `dart:html`.