Skip to content
Adonis (adonisjs) high level web sockets. Implements the websocket protocol specified by adonisjs.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
example Initial upload Nov 18, 2019
lib More fixes Nov 18, 2019
test Initial upload Nov 18, 2019
.gitignore Initial upload Nov 18, 2019
.metadata Initial upload Nov 18, 2019 More fixes Nov 18, 2019
LICENSE Initial upload Nov 18, 2019
pubspec.lock Initial upload Nov 18, 2019
pubspec.yaml More fixes Nov 18, 2019


A high level adonisjs websockets implementation for dart, flutter and web.

Getting Started

/// For HTML:
/// import 'package:adonis_websok/html.dart';
/// For IO (Flutter, Dart, etc.)
import 'package:adonis_websok/io.dart';

void main() async {
  // Create a websocket connection and attach a JWT to it.
  // For HTML: IOAdonisWebsok -> HTMLAdonisWebsok
  final socket = IOAdonisWebsok(host: '', port: 3333)
  // Connect to the socket and await for response from the adonis server.
  await socket.connect();
  // Subscribe to the 'disponible' topic.
  final disponible = await socket.subscribe('disponible');
  // Set a callback to execute when a new event comes by.
  disponible.on('canvi', (data) => print('canvi: ${data.toString()}'));
  // To stop the listener, just perform'canvi')
  // Emit send a new message to the server, with additional data if needed.
  disponible.emit('canvi'); // Accepts a data argument as the 2nd parameter.
  // Close the subscription (unsubscribe from the given topic).
  final closed = await disponible.close(); // Unsubscribe.
  // CLoses the socket connection.
You can’t perform that action at this time.