0.9.8 • Published 5 months ago

tournament-assistant-client v0.9.8

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Tournament Assistant Client

NPM Version

A typescript & websocket based client for Tournament Assistant a Beat Saber tournament mod

Install

npm i tournament-assistant-client

Usage

The following will setup a basic Coordinator client and connect you to the TA server.

Import

import { Client } from "tournament-assistant-client";

new Client("Danny", {
    url: "ws://localhost:2053"
});

Browser Script

<script src="https://www.unpkg.com/tournament-assistant-client@0.9.5/dist/tournament-assistant-client.min.js"></script>
<script>
    const taWS = new TournamentAssistantClient.Client("Danny", {
        url: "ws://localhost:2053"
    });
</script>

Base Options

optiontypedescrequired
urlstringa websocket url that the TA server is hosted attrue
passwordstringPassword to access the TA server if it has onefalse
userIdstringUser Id of the connecting coordinatorfalse
optionsconnection optionsSpecific connection options to manage the TA Client, listed belowfalse

Connection Options

optiontypedescDefault
autoReconnectbooleanDetermines if it the client will attempt to reconnect to the server whenever it loses connection.true
autoReconnectIntervalnumberThe number of ms to wait after losing connection before attempting to reconnect.10000
autoReconnectMaxRetriesnumberMaximum number of failed connection attempts to the server before it gives up. Setting to -1 will disable the option-1
handshakeTimeoutnumberWebsocket handshake timeout0
autoInitbooleanWhether or not to automatically initiate the connection when the constructor is calledtrue
sendToSocketfunctionAn alternate function that the client can use to send packets to the TA server. This can be used in conjunction with the previous option if you'd like to integrate your own websocket implementation as opposed to using the built in onenull

Custom Transport

By providing a sendToSocket function and disabling autoInit you can overwrite the default websocket implementation in place for your own. sendToSocket will be used by any internal functions to send packets out through that websocket and incoming packets can be passed to handlePacket.

Events

import { Client } from "tournament-assistant-client";

const taClient = new Client("Danny", {
    url: "ws://localhost:2053"
});

taClient.on("EVENT_NAME", e => {
    // listen to events here
});

Supported Events

User Events
  • userAdded
  • userUpdated
  • userLeft
Match Events
  • matchCreated
  • matchUpdated
  • matchDeleted
Qualifier Events
  • qualifierEventCreated
  • qualifierEventUpdated
  • qualifierEventDeleted
Commands
  • loadSong
  • playSong
  • sendBotMessage
  • showModal
Push Events
  • pushLeaderboardScore
  • songFinished
  • realtimeScore
Requests
  • connectRequest
  • leaderboardScoreRequest
  • preloadImageForStreamSync
Responses
  • connectResponse
  • leaderboardScoreResponse
  • loadedSong
  • modalResponse
  • imagePreloaded
Other
  • acknowledgement
  • forwardingPacket
  • packet
Non-TA related Events
  • wsConnected
  • taConnected
  • close
  • error

Versions

TA VersionClient Version
0.7.40.9.5 ~ 0.9.6
0.7.30.9.4
0.7.20.9.2
0.7.0 ~ 0.7.10.9.1

License

MIT

0.9.8

5 months ago

0.9.7

7 months ago

0.9.6

10 months ago

0.9.4

1 year ago

0.9.3

1 year ago

0.9.5

1 year ago

0.9.2

1 year ago

0.9.1

1 year ago

0.8.2-0

2 years ago

0.9.0

1 year ago

0.8.1

2 years ago

0.8.0

2 years ago

0.7.5

2 years ago

0.7.2

2 years ago

0.7.4

2 years ago

0.7.3

2 years ago

0.7.1

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.4.3

2 years ago

0.4.2

2 years ago

0.4.1

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago