javascript implementation of go-back-n ARQ protocol