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

outdated

A WebSocket Library written in Pure Dart.

example/polo_server_example.dart

import 'package:polo_server/polo_server.dart';

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

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

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

    client.onEvent('message',
        (message) => print("Message from Client(${client.id}): $message"));

    client.onEvent('userJoined',
        (data) => print("UserJoined(${client.id}): ${data.toString()}"));

    client.send('message', "Hi From Server!");
  });

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

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

Publisher

unverified uploader

A WebSocket Library written in Pure Dart.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

uuid

More

Packages that depend on polo_server