zaptools_server 0.3.0 zaptools_server: ^0.3.0 copied to clipboard
A toolkit for Event-Driven websocket management.
example/zaptools_server_example.dart
import 'package:zaptools_server/zaptools_server.dart';
void main() async {
final app = ZapServer();
app.onConnected((contexts) {
print('client connected');
});
app.onDisconnected((context) {
print('client disconnected!');
});
app.onEvent('hello', (context) {
context.connection.send('bye', 'see ya!');
});
final server = await app.start();
print('listen on -> ${server.port}');
}