Bonsoir
A Zeroconf library that allows you to discover network services and to broadcast your own. Based on Apple Bonjour and Android NSD.
Install / Use
/learn @Skyost/BonsoirREADME
Bonsoir is a Zeroconf library that allows you to discover network services and to broadcast your own. It's based on Android NSD and on Apple's popular framework Bonjour. In fact, <q>Bonsoir</q> can be translated into <q>Good evening</q> (and <q>Bonjour</q> into <q>Good morning</q> or <q>Good afternoon</q> depending on the current moment of the day).
Preview

Installation
See how to install on the Bonsoir website.
Code snippet
Here is how you can broadcast your service using Bonsoir :
// Let's create our service !
BonsoirService service = BonsoirService(
name: 'My wonderful service', // Put your service name here.
type: '_wonderful-service._tcp', // Put your service type here. Syntax : _ServiceType._TransportProtocolName. (see http://wiki.ros.org/zeroconf/Tutorials/Understanding%20Zeroconf%20Service%20Types).
port: 3030, // Put your service port here.
);
// And now we can broadcast it :
BonsoirBroadcast broadcast = BonsoirBroadcast(service: service);
await broadcast.initialize();
await broadcast.start();
// ...
// Then if you want to stop the broadcast :
await broadcast.stop();
And here is how you can search for a broadcasted service :
// This is the type of service we're looking for :
String type = '_wonderful-service._tcp';
// Once defined, we can start the discovery :
BonsoirDiscovery discovery = BonsoirDiscovery(type: type);
await discovery.initialize();
// If you want to listen to the discovery :
discovery.eventStream!.listen((event) { // `eventStream` is not null as the discovery instance is "ready" !
switch (event) {
case BonsoirDiscoveryServiceFoundEvent():
print('Service found : ${event.service.toJson()}');
event.service!.resolve(discovery.serviceResolver); // Should be called when the user wants to connect to this service.
break;
case BonsoirDiscoveryServiceResolvedEvent():
print('Service resolved : ${event.service.toJson()}');
break;
case BonsoirDiscoveryServiceUpdatedEvent():
print('Service updated : ${event.service.toJson()}');
break;
case BonsoirDiscoveryServiceLostEvent():
print('Service lost : ${event.service.toJson()}');
break;
default:
print('Another event occurred : $event.');
break;
}
});
// Start the discovery **after** listening to discovery events :
await discovery.start();
// Then if you want to stop the discovery :
await discovery.stop();
If you want a <q>full</q> example, don't hesitate to check this one on Github.
Contributions
You have a lot of options to contribute to this project ! You can :
Related Skills
node-connect
354.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
112.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
354.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
354.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
