polo_server 0.0.3 copy "polo_server: ^0.0.3" to clipboard
polo_server: ^0.0.3 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. #

📦 Packages #

Name Link Language / Runtime
polo_server pub package Dart
polo_client pub package Dart
polo_client_ts pub package Deno (TypeScript)

✨ Features #

  • Multi-Platform
    • Android, IOS, Windows, Linux, macOS, Web.
  • Typed Events
    • Refer PoloType and PoloTypeAdapter.
  • Library Officially Available in Multiple Programming Languages
    • Dart, TypeScript.
  • Easy to Use API

📖 Getting Started #

Basic Chat App #

  • Server Code (Dart)
  // Polo Server
  PoloServer server = await Polo.createServer();

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

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

  server.onClientDisconnect((client) {
    print("Client(${client.id}) Disconnected!");
  });
  • Client Code (Dart)
  // Polo Client
  PoloClient client = await Polo.connect("ws://127.0.0.1:3000/");

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

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

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

  client.listen();
  • Client Code (TypeScript)
// Polo Client
const client: PoloClient = await Polo.connect("ws://127.0.0.1:3000/");

client.onConnect(() => {
  console.log("Client Connected to Server");
});

client.onDisconnect(() => {
  console.log("Client Disconnected from Server");
});

client.onEvent<string>("message", (message) => {
  console.log(`${message}`);
});

client.listen();

💪 Contributions #

10
likes
140
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