🔧 Simple API for building games using WebSockets.
TypeScriptMIT
websocket-game-lobby-client
🔧 Simple API for building games using WebSockets.
Install
$ npm install websocket-game-lobby-client
Example
import{WebSocketGameLobbyClient}from'websocket-game-lobby-client';constgameLobby=newWebSocketGameLobbyClient();gameLobby.addEventListener('message',({ data })=>{console.log(JSON.parse(data));});document.querySelector('button').addEventListener('click',()=>gameLobby.send('create'));
gameLobby.addEventListener('open',()=>{console.log('connected');});gameLobby.addEventListener('message',({ data })=>{console.log(JSON.parse(data));});gameLobby.addEventListener('close',()=>{console.log('disconnected');});