TinyBase logoTinyBase

getConnection

The getConnection method returns the PartySocket the Store is being persisted to.

getConnection(): PartySocket
returnsPartySocket

The PartySocket.

Example

This example creates a Persister object against a newly-created Store and then gets the PartySocket back out again.

const partySocket = new PartySocket({
  host: PARTYKIT_HOST,
  room: 'my_room',
});
const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
const persister = createPartyKitPersister(store, partySocket);

console.log(persister.getConnection() == partySocket);
// -> true

persister.destroy();

Since

v4.3.14