Introduction of Cyberfly IO pubsub network

Cyberfly
3 min readMar 11, 2024

--

Distribute data between devices in decentralised manner

Previously, our communication infrastructure relied on MQTT, which, while effective, suffered from centralisation. This centralisation was evident in its dependence on a single message broker. If this MQTT broker experienced downtime, it resulted in a complete cessation of communication between devices, presenting a significant single point of failure.

Indeed, recognising the limitations posed by a centralised communication model, we made the strategic decision to migrate our infrastructure to libp2p. This transition allows for a decentralised approach, eliminating the single point of failure inherent in MQTT.

Introducing the Cyberfly pubsub network! With the Cyberfly platform, we’ve taken a revolutionary step towards creating a robust and resilient communication infrastructure. Built on the principles of decentralization and peer-to-peer connectivity, Cyberfly leverages the power of libp2p to facilitate seamless and reliable communication between devices.

Gone are the days of worrying about a single point of failure. The Cyberfly pubsub network distributes communication pathways across multiple nodes, ensuring that even if one node goes down, the network remains operational. This resilience enhances the reliability and availability of communication between devices, promoting uninterrupted workflows and operations.

Furthermore, the pubsub model employed by Cyberfly enables efficient and scalable message distribution. Devices can publish messages to specific topics of interest, and subscribers receive relevant updates in real-time. This streamlined approach minimizes latency and optimizes resource utilization, making Cyberfly an ideal solution for a wide range of applications, from IoT ecosystems to distributed computing environments.

In essence, Cyberfly empowers you to build resilient, decentralized communication networks that adapt and thrive in dynamic environments. Say goodbye to the limitations of centralization and embrace the future of peer-to-peer connectivity with Cyberfly pubsub network.

Example code for pubsub

#subscribe to a topic
import socketio

# Create a Socket.IO client
sio = socketio.Client()

# Define event handlers
@sio.event
def connect():
print('Connected to server')

@sio.event
def disconnect():
print('Disconnected from server')

@sio.event
def onmessage(data):
print('Received Message:', data)

# Connect to the node
sio.connect('http://node.cyberfly.io:3000/')

# subscribe to topic test
sio.emit('subscribe', 'test')

# Wait for events indefinitely
sio.wait()
#publish data to the specific topic
import socketio
import time
# Create a Socket.IO client
sio = socketio.Client()

# Define event handlers
@sio.event
def connect():
print('Connected to server')

@sio.event
def disconnect():
print('Disconnected from server')

# Connect to the local node
sio.connect('http://localhost:3000')

# Send messages to the topic 'test'
for i in range(0, 5):
sio.emit('publish', ("test", "hello"))
time.sleep(2)
sio.wait()

In conclusion, the introduction of the Cyberfly PubSub Network marks a pivotal moment in the evolution of communication infrastructure. By embracing decentralization and leveraging the power of libp2p, Cyberfly offers a robust solution that eliminates single points of failure and fosters resilience in interconnected systems. With its innovative pubsub model, Cyberfly facilitates real-time communication and resource optimization, paving the way for a future where peer-to-peer connectivity thrives. Embrace the potential of Cyberfly and embark on a journey towards a more resilient, adaptable communication landscape.

--

--