Skip to content

Commit

Permalink
Tweaking has occurred:
Browse files Browse the repository at this point in the history
- Adds a deprecated compatibility shim to support the old API
- Do a minor version bump instead of a major one since the API is compatible
- Splits up types into their own file
- Mark _sendTopic as an internal function
- Updates documentation
- Fixes a bug where requests would be sent at the same time
- Adds queue length property to topic connection to help with pooling implementations
- Adds destroyed property to topic connection to help with pooling implementations
  • Loading branch information
alexkar598 committed Mar 25, 2022
1 parent 213844a commit f05b4bd
Show file tree
Hide file tree
Showing 12 changed files with 326 additions and 357 deletions.
45 changes: 34 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,43 @@ A communication layer between node.js and BYOND game servers.

### Example
```javascript
const http2byond = require("./index.js");
let connection = new http2byond({
timeout: 2000
const {createTopicConnection} = require("./index.js");
let connection = createTopicConnection({
host: "localhost",
port: 6666
})

connection.send("status").then((body) => {
console.log(body);
}, (err) => {
console.error("ERR", err);
});

var form = {
ip: "localhost",
port: "6666",
topic: "?status"
};
async function anAsyncFunction() {
const result = connection.send("status");
}
```

OR

connection.run(form).then((body) => {
console.log(body);
```javascript
const {sendTopic} = require("./index.js");

sendTopic({
host: "localhost",
port: 6666,
topic: "status"
}).then((body) => {
console.log(body);
}, (err) => {
console.error("ERR", err);
console.error("ERR", err);
});

async function anAsyncFunction() {
const result = await sendTopic({
host: "localhost",
port: 6666,
topic: "status"
});
}
```
166 changes: 0 additions & 166 deletions index.js

This file was deleted.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "http2byond",
"description": "Communication layer between node.js and BYOND game servers.",
"version": "3.0.0",
"version": "2.1.0",
"scripts": {
"prepare": "npx tsc"
},
Expand Down
Loading

0 comments on commit f05b4bd

Please sign in to comment.