{"repo":"Tom32i/netcode","free":true,"listed":false,"github":"https://github.com/Tom32i/netcode","clone":"git clone https://github.com/Tom32i/netcode.git","description":"Fast and efficient real-time communication websocket engine for multiplayer games in the browser.","language":"JavaScript","stars":16,"topics":["netcode","websocket","real-time","gamedev","multiplayer","multiplayer-game-server","multiplayer-game","websockets"],"license":"MIT","category":"game-templates","readme_excerpt":"Netcode ======= A simple JavaScript client & server binary-encoded websocket communication system aimed towards web video games development. Features: - 🔌 Server / Client duo, for node and the browser, that handle Websocket connection and communication. - ⚡️ Handle the binary encoding and decoding of your data, with performances in mind. - 📢 Listen for event dispatched over websocket with simple on / off event emitter system. - 💬 Fallback to JSON for easy debugging. - 🐹 Golang server port available, wire-compatible with the JavaScript client. Requirements - Node = v24.0.0 Installation npm add netcode Get started Define a list of events The server and the client must share the same ordered list of events. An event is defined by its unique name and the corresponding codec, responsible for encoding and decoding the data. In this example, the event list define how to send the following events over websocket: - client.send('id', 255); - client.send('say', 'Hello world!'); Then you'll be able to listen for these events on the client as follow: - client.on('id', id = { / Do something / }); - client.on('say', sentence = { / Do something / }); Now let's create a server and a client that use this event list. Setup a Server We setup a server specifying the port and host on which the server will listen and the type of encoder to use. Here we use a BinaryEncoder to communicate in binary over websocket, with the previously configured event list. Now we've got a server running at localh","default_branch":null,"files":null,"tree":[],"storefront":"/r/Tom32i","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/Tom32i/netcode/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}