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

Libraries

polo_server
Support for doing something awesome.