R/event_handler.r

Defines functions handle

source("R/event_dispatcher.r")
source("R/event_heartbeat.r")

handle <- function(op, data, client) {
  switch(toString(op),
    "9"={start_connection(client)},
    "10"={heartbeat(data$d$heartbeat_interval, client)},
    "0"={dispatch(data, client)},
    {print(op)} #identify
  )
}
TheOnlyArtz/Pirate documentation built on Oct. 31, 2019, 12:12 a.m.