Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePhar committed Jun 14, 2022
1 parent 9941ed3 commit 3ed377f
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,42 @@
# Archipelago.js
![GitHub](https://img.shields.io/github/license/thephar/archipelago.js?style=flat-square) ![GitHub package.json version](https://img.shields.io/github/package-json/v/thephar/archipelago.js?style=flat-square) ![GitHub repo size](https://img.shields.io/github/repo-size/thephar/archipelago.js?style=flat-square) ![Discord](https://img.shields.io/discord/731205301247803413?label=discord&style=flat-square)
![GitHub](https://img.shields.io/github/license/thephar/archipelago.js?style=flat-square)
![npm](https://img.shields.io/npm/v/archipelago.js?style=flat-square)
![npm type definitions](https://img.shields.io/npm/types/archipelago.js?style=flat-square)
![npm](https://img.shields.io/npm/dm/archipelago.js?style=flat-square)

A general purpose library for communicating with Archipelago servers via Node.js.

## Getting Started

```javascript
import { ArchipelagoClient, NetworkVersion, SayPacket } from "archipelago.js";
import { ArchipelagoClient, NetworkVersion } from "archipelago.js";

// Set up our client.
const version = new NetworkVersion(0, 3, 2);
const client = new ArchipelagoClient("10.0.0.92:38281", version);

// Connect to the AP server and log in.
client.connect("CC", "Phar")
// Send packets!
.then(() => client.send(new SayPacket("Hello, world!")))
// Connect to the Archipelago server!
client
.connect("Archipelago", "Test")
.then(() => {
// Send a client packet!
client.send({ cmd: "Say", text: "Hello world!" });
})
.catch(console.error);

// Listen for packets.
client.addListener("packetReceived", (packet) => {
console.log(packet);
// Listen for events!
client.addListener("print", (packet) => {
console.log(packet.text);
});
```

The `ArchipelagoClient` handles all the main interactions with the Archipelago server, including sending and receiving packets and maintaining the websocket connection.

Currently, there are no helper functions to assist in most tasks, so a lot of the functionality still requires manual listening to certain packets and handling them accordingly.
The `ArchipelagoClient` handles all the main interactions with the Archipelago server, including sending and receiving
packets and maintaining the websocket connection.

This library is still in development so more features will be coming to make developing with this library easier.

### Written in TypeScript

This application was written in TypeScript and thus has access to all the type information of each packet and its parts. You can still load this application in vanilla JavaScript if you prefer, though and still have access to type information.
This application was written in TypeScript and thus has access to all the type information of each packet and its parts.
You can still load this application in vanilla JavaScript if you prefer, though and still have access to type
information.

0 comments on commit 3ed377f

Please sign in to comment.