1.5.6 • Published 10 months ago

websocket-game-lobby-client-hooks v1.5.6

Weekly downloads
16
License
MIT
Repository
github
Last release
10 months ago

websocket-game-lobby-client-hooks

⚛️ React hooks for use with websocket-game-lobby

NPM Version

Install

$ npm install websocket-game-lobby-client-hooks

API

useWebSocketGameLobbyClient

const { data, connected, send } = useWebSocketGameLobbyClient({
    port = 80,
    keepAliveMilliseconds = 30000
});

Options

NameDescriptionDefault
portPort to connect to WebSocket server.80
keepAliveMillisecondsInterval at which to ping the websocket-game-lobby server.30000

send(type, data);

Type
NameDescription
createCreate a new game.
joinJoin existing game with game code.
leaveLeave current game.
startStart current game.
endEnd current game.
Examples
send('create'); // Create new game
send('join', { gameCode: 'ABCD' }); // Join game with game code
send('leave'); // Leave current game
send('start'); // Start current game
send('end'); // End current game
1.5.6

10 months ago

1.5.5

4 years ago

1.5.4

4 years ago

1.5.3

4 years ago

1.5.2

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago