Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

Latest commit

 

History

History
39 lines (29 loc) · 1.07 KB

README.md

File metadata and controls

39 lines (29 loc) · 1.07 KB

hiven-gw

This can be useful for microservicing hiven bots.

how 2 use

In order to accomplish 0 loss on messages, hiven-gw uses RPUSH and BLPOP in redis. Now create a .env and put the contents in

TOKEN="your hiven token (found in localStorage)"
REDIS="localhost:6379"
LIST="gateway"
DISABLED_EVENTS="TYPING_START" # comma separeted list of disabled events (will not push to redis)
ZLIB=true # enable if you would like to recieve compressed zlib from hiven
DEBUG=true # enable if you want to recieve debug msgs (op, hb)

Then you will need to build hiven-gw by doing go build Now you can run the executable it creates: ./hivengw

recieving

You can run BLPOP gateway 0 in redis to get data. You can do a while loop that does that command.

fetching gateway runtime stats

Gateway runtime stats are sent every 30 seconds to the configured list (e.g. gateway) (on every heartbeat). The payload will look like this: Note: stats event can't be disabled with DISABLED_EVENTS

{
  "e": "stats",
  "stats": {
    Alloc: 17310048,
    ...otherstats
  }
}