att-websockets
TypeScript icon, indicating that this package has built-in type declarations

1.1.4 • Public • Published

att-websockets

Websocket connections for ATT

Create a connection

let serverId = 123;
let connectionName = "Test";

//import { Servers } from 'alta-jsapi'
let access = new JsapiAccessProvider(serverId, Servers);
let connection = new Connection(access, connectionName);

connection.onMessage = console.log;

try
{
    await connection.open();

    connection.send("player kill Joel");
}
catch (e)
{
    console.error("Error connecting to server");
    console.error(e);
}

Use the basic wrapper

This is recommended for 90% of cases, as it handles subscriptions and command responses

let wrapper = new BasicWrapper(connection);

var result = await wrapper.send("spawn joel dynamite");

wrapper.subscribe("PlayerJoined", console.log);

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.4
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.4
    2

Package Sidebar

Install

npm i att-websockets

Weekly Downloads

2

Version

1.1.4

License

GPL-3.0

Unpacked Size

64.1 kB

Total Files

14

Last publish

Collaborators

  • narmdo