Package Exports
- apexprotoc.js
- apexprotoc.js/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (apexprotoc.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
apexprotoc.js
A simple library for Apex Legends LiveAPI 2.0 using protobufjs.
apexprotoc.js
connects to your Apex Legends LiveAPI stream allowing you to receive and listen to Live API Events in the form of javascript objects and send requests to your Apex client.
Install
npm install "apexprotoc.js"
For this package to work, you need to enable LiveAPI for Apex Legends by configuring the game's launch options:
+cl_liveapi_enabled 1 +cl_liveapi_ws_servers "ws://127.0.0.1:{PORT}"
Usage example
const apexprotoc = require('apexprotoc.js');
const Server = new apexprotoc.Server();
Server.on('gameStateChanged', (gameStateData) => {
if (gameStateData.state === "playing") {
Server.send('CustomMatch_SendChat', { text: "glhf!" })
}
})
Server.once('connection', async () => {
console.log('Server connected with Apex client!')
Server.send('CustomMatch_CreateLobby')
await Server.once('response')
// May need to yeild for lobby to load depending on your PC
const LobbyPlayersData = await Server.get('CustomMatch_GetLobbyPlayers')
console.log(`Lobby code is: ${LobbyPlayersData.playerToken}`)
});
Server.listen(7777);