Creates a new RoomController instance and initializes the socket connection.
the host used when creating the socket connection.
The ID of the room to connect to.
What cookies are currently set.
A function to allow updating cookies.
A function called when the connection was opened the first time.
The config of this room
The current ping in milliseconds.
The amount of filtered songs
ReadonlygetWhat cookies are currently set.
Readonlyhostthe host used when creating the socket connection.
OptionalpingThe interval of the ping function.
The current ping sequence number.
The performance.now() timestamp when the last ping was sent.
The list of songs played in the last round.
The name of the song artist.
A URL to the audio file of the song. Currently only audio previews from Apple Music and SoundCloud are allowed.
Cover URL of the song.
The URL users will be redirected to when clicking.
The name of the song.
The current list of playlists selected for the game.
Cover URL of the playlist.
The URL users will be redirected to when clicking.
Name of the playlist
A list of song names and music urls
Optionalsubtitle?: stringAn optional subtitle with additional information about the playlist
The last received sequence number by the server.
The currently cached ingame data
Whether the WebSocket is currently reconnecting
ReadonlyroomThe ID of the room to connect to.
ReadonlysetA function to allow updating cookies.
ReadonlysetA function called when the connection was opened the first time.
Whether the current player is the host of the room.
The current list of just player messages of this room.
OptionalanswerData?: {The current answer of this player.
Optionalanswer?: stringProvided only for PlayerPicksGame. The answer the player selected.
OptionalanswerIndex?: numberProvided only for MultipleChoiceGame. The index of the question the player selected.
The relative time in ms a player took to answer a round question.
The absolute time in ms where the player answered a round question.
The points the player got for the current question.
The player's color
True, if the receiver is the host
True, if this player is just spectating
How many points the player had in the last round.
The player's username
The current list of players in the room.
The current game state.
The user's id.
The current username of the player.
The server-assigned uuid of this player.
Requests the server to add a playlist
the playlists to add
Cover URL of the playlist.
The URL users will be redirected to when clicking.
Name of the playlist
A list of song names and music urls
Optionalsubtitle?: stringAn optional subtitle with additional information about the playlist
Cleans up resources and closes the socket connection.
Serializes the current collection of playlists into a standardized JSON string.
Imports playlists from a validated PlaylistsFile object.
The validated PlaylistsFile object containing playlist data.
The playlists of this export.
Version of this export. Only used for validation.
Sends the picked song to the server for PlayerPicksGame.
The song the player picked.
The name of the song artist.
A URL to the audio file of the song. Currently only audio previews from Apple Music and SoundCloud are allowed.
Cover URL of the song.
The URL users will be redirected to when clicking.
The name of the song.
The start position for the audio.
(Re)connect to the PartyKit server.
OptionalnewUsername: stringoptionally request a new username when reconnecting.
whether the player wants to spectate the game.
Registers a listener that will be called whenever the state of the room changes.
The ListenerCallback function.
A function to unregister the listener.
Requests the server to remove a playlist from the list.
the index of the playlist to remove. null to remove all playlists.
Requests the server to return to the lobby.
Sends the selected answer to the server for MultipleChoiceGame.
The index of the selected answer (0-3).
Sends the text answer (song guess) to the server for PlayerPicksGame.
The song name the player guessed.
Asks the server to update config.
Requests the server to start the game.
Requests a host transfer from the server.
The name of the player that should get host.
Unregisters a previously registered state change listener.
The ListenerCallback function.
Updates the username of the current player.
The new username to set.
Manages the connection and state of a room.