Skip to content

Asynchronous WebSocket Server will listen to your applications status, whenever one goes down, you'll be able to know via Discord using DiscordWebhooks.

License

Notifications You must be signed in to change notification settings

ChutiReality/heartbeat-listener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pseudocode

async def gatherer():
    # We create a list named tasks
    for each service in the sockets.json file, we run what's below:
        Create a Heartbeat class and pass the information contained in the service
        Append to the tasks list a create_task function containing the start() function of the Heartbeat class
        
    We asyncio.gather(*tasks) to run multiple coroutines concurrently

async def main():
    Create task for gatherer function
    Await the above task

Run main function

Setup new socket

[
    {
        "Name":"Name of service",
        "URL":"ws://IP:PORT/",
        "Webhook":"Discord Webhook. e.g: https://discord.com/api/webhooks/...",
        "Message":"Personalized Send Message",
        "Interval": "How often to ping the socket. Has to be a number",
        "Timeout": "webhook.send timeout. Has to be a number"
    },
    {
        "Name":"Example",
        "URL":"ws://localhost:8000/",
        "Webhook":"Discord Webhook. e.g: https://discord.com/api/webhooks/...",
        "Message":"Personalized Send Message",
        "Interval":5,
        "Timeout":5
    }
]

About

Asynchronous WebSocket Server will listen to your applications status, whenever one goes down, you'll be able to know via Discord using DiscordWebhooks.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages