polo_server 0.0.2 copy "polo_server: ^0.0.2" to clipboard
polo_server: ^0.0.2 copied to clipboard

A WebSocket Library written in Pure Dart. Easy API for writing WebSocket based Apps or Games. Also Support for Flutter and Web.

example/polo_server_example.dart

import 'package:polo_server/polo_server.dart';

void main() async {
  // Manager
  // Polo polo = await Polo.createManager();
  // PoloServer server = polo.of('/chat');

  // Direct Server
  PoloServer server = await Polo.createServer();

  server.onClientConnect((client) {
    print("Client(${client.id}) Connected!");

    client.onEvent('message',
        (message) => server.broadcastFrom(client.id, 'message', message));
  });

  server.onClientDisconnect((client) {
    print("Client(${client.id}) Disconnected!");
  });

  print("Server Running...");
}
10
likes
150
pub points
52%
popularity

Publisher

unverified uploader

A WebSocket Library written in Pure Dart. Easy API for writing WebSocket based Apps or Games. Also Support for Flutter and Web.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

uuid

More

Packages that depend on polo_server