Skip to content

Instantly share code, notes, and snippets.

View 0xCurtis's full-sized avatar
Focusing

КЮРТИС 0xCurtis

Focusing
View GitHub Profile
@0xCurtis
0xCurtis / EventListener.py
Created March 1, 2024 12:50
Event Based Websocket Listener in Python
class EventListener:
def __init__(self, uri):
self.uri = uri
self.on_message_callbacks = []
def on_message(self, callback):
self.on_message_callbacks.append(callback)
async def _notify_message_received(self, message):
for callback in self.on_message_callbacks: