Skip to content

hanahaneull/trakteer-ws

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

trakteer-ws


Trakteer.id websocket connection

Usage

const client = require('./index.js')
const trakteer = new client()
trakteer.login({
  // Read CREDENTIALS.md
  'XSRF-TOKEN': 'XSRF TOKEN',
  'trakteer-id-session': 'SESSION ID',
  channel: 'CHANNEL'
})

Event

ready

trakteer.on('ready', x => console.log(x))
// Return current time

connect

trakteer.on('connect', x => console.log(x))
// Return current time

disconnect

trakteer.on('disconnect', x => console.log(x))
// Return current time

supporter

trakteer.on('supporter', x => console.log(x))
// {
//    "order_id":"e21fc269-69dd-6969-98c3-595046997701",
//    "supporter_name":"Seseorang",
//    "creator_name":"hana",
//    "unit":"Bitcoin",
//    "quantity":1,
//    "price":"Rp 1.000",
//    "supporter_avatar":"https://cdn.trakteer.id/images/mix/default-avatar.png",
//    "unit_icon":"https://trakteer.id/storage/images/units/uic-alUKvPOMiKa0WIjj03xaOkuw37Zcle4Y1594826060.png",
//    "supporter_message":null,
//    "id":"691663ad-694d-69e9-6969-549d6b01b469",
//    "type":"new-tip-success"
// }

notification

trakteer.on('notification', x => console.log(x))
// Gunakan event 'supporter' jika hanya mengambil data donasi
// {
//    "order_id":"e21fc249-26dd-5265-98c3-595046497701",
//    "supporter_name":"Seseorang",
//    "creator_name":"hana",
//    "unit":"Bitcoin",
//    "quantity":1,
//    "price":"Rp 1.000",
//    "supporter_avatar":"https://cdn.trakteer.id/images/mix/default-avatar.png",
//    "unit_icon":"https://trakteer.id/storage/images/units/uic-alUKvPOMiKa0WIjj03xaOkuw37Zcle4Y1594826060.png",
//    "supporter_message":null,
//    "id":"f51663ad-814d-43e9-9415-549d6b01b4b0",
//    "type":"new-tip-success"
// }

debug

trakteer.on('debug', x => console.log(x))
// {
//   type: 'connect', // ['connect', 'csrf', 'authkey', 'disconnect', 'heartbeat-send', 'heartbeat-receive', 'notification']
//   value: 'Websocket connected'
// }

About

Trakteer websocket connection

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published