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.

Polo: WebSocket Library #

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

✨ Features #

  • Multi-Platform
    • Android, IOS, Windows, Linux, macOS, Web
  • Easy to Use API

Getting Started #

Baic Chat App #

  • Server Code
// Polo 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!");
  });
  • Client Code
  // Polo Client
  PoloClient client = await Polo.connect("ws://127.0.0.1:3000/");

  // PoloWecClient (if using from Flutter Web or Dart Web (webdev))
  PoloWebClient client = await PoloWeb.connect("ws://127.0.0.1:3000/");

  client.onConnect(() {
    print("Client Connected to Server");
  });

  client.onDisconnect(() {
    print("Client Disconnected from Server");
  });

  client.onEvent('message', (message) {
    print("$message");
  });

  client.listen();

💪 Contributions #

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