polo_server 0.0.2 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...");
}